Skip to content

Instantly share code, notes, and snippets.

@coopermaruyama
Last active August 29, 2015 14:26
Show Gist options
  • Save coopermaruyama/6ae289a9170f8062b1c9 to your computer and use it in GitHub Desktop.
Save coopermaruyama/6ae289a9170f8062b1c9 to your computer and use it in GitHub Desktop.
Docker Notes
# --------------------------------------------------------------------------------------------------------
# BASIC ACTIONS
# -------------------------------------------------------------------------------------------------------
# start up a new machine
docker-machine create --driver virtualbox dev
# list VMs
docker-machine ps
# setup environment vars for a specific machine - this 'bind' the current terminal to the selected machine.
eval "$(docker-machine env dev)"
# ----------------------------------------------------------------------------------------------------------
# Spin up a Docker + Ubuntu Droplet on Digital Ocean
# ---------------------------------------------------------------------------------------------------------
# Get API key from DO account dashboard first, then:
docker-machine create --driver digitalocean --digitalocean-access-token <APIKEY> staging
# Build relationship
eval "$(docker-machine env staging)"
# -------------------------------------------------------------------------------------
# COMMON ERRORS
# --------------------------------------------------------------------------------------
# Error message:
# `/var/run/docker.sock: no such file or directory. Are you trying to connect to a
# TLS-enabled daemon without TLS?
# Reason:
# This is caused by the environment variables which inform the terminal about the container to
# manage not being set. The terimanl needs a variable set that looks like 'http://192.168.99.201:2376'
# which it sends messages through. When it's not set, no messages can go through! This is exactly the
# purpose of eval "$(docker-machine env dev)" ('dev' is simply what we named the container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment