In this post, I will record the process through which I attempt to use Docker Machine to deploy a simple Haskell application on Digital Ocean.
To get an OSX docker machine running, I had to download
two binaries:
machine
and a version of docker with Identity
Authentication. I will refer to these as machine-docker
and machine-docker-1.3.1-dev-identity-auth
respectively.
machine-docker
is a new binary while
machine-docker-1.3.1-dev-identity-auth
is the usual
docker
binary with some additional commits.
test-machine
:> machine-docker create -d virtualbox test-machineINFO[0000] Downloading boot2docker...INFO[0021] Creating SSH key...INFO[0021] Creating VirtualBox VM...INFO[0029] Starting VirtualBox VM...INFO[0029] Waiting for VM to start...INFO[0061] "test-machine" has been created and is now the activemachine. To point Docker at this machine, run: exportDOCKER_HOST=$(machine url) DOCKER_AUTH=identity
~/.zshrc
to-machine(){export DOCKER_HOST=$(machine-docker url) DOCKER_AUTH=identity}
docker ps
in a new shell:> to-machine> machine-docker-1.3.1-dev-identity-auth psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
DO_TOKEN
:export DO_TOKEN=mytokenhere235bhn2b23j5k
> machine-docker create -d digitalocean --digitalocean-access-token=$DO_TOKEN biscarch/botINFO[0000] Creating SSH key...INFO[0000] Creating Digital Ocean droplet...INFO[0002] Waiting for SSH...INFO[0103] "biscarch/bot" has been created and is now the activemachine. To point Docker at this machine, run: exportDOCKER_HOST=$(machine url) DOCKER_AUTH=identity
biscarch/bot
> to-machine
docker ps
on Digital Ocean> machine-docker-1.3.1-dev-identity-auth psThe authenticity of host "$ip:$port" can't be established.Remote key ID XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXXAre you sure you want to continue connecting (yes/no)? yesCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
docker run
on Digital Ocean> machine-docker-1.3.1-dev-identity-auth run -itp 8000:8000 snapforbeginners/barebonesno port specified, defaulting to port 8000Listening on http://0.0.0.0:8000/
> curl $DO_IP:8000hello world
That’s it. We have a Docker Engine and a container running on Digital Ocean. We can also run multiple containers as Daemons and all of the normal goodness of the Docker CLI.