The easy way is to not install Docker, just let Docker Machine do the job, in order to do that install Docker Machine.
Important
First of all let's remove stupid issue with Windows bash console and trailing slash that I do not want to cover, in order to resolve this issue we will use Linux machine only.
From an Linux console install Docker Machine with the following commands:
$ curl -L https://github.com/docker/machine/releases/download/v0.13.0/docker-machine-`uname \ -s`-`uname -m` >/tmp/docker-machine && chmod +x /tmp/docker-machine && sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
Take some scripts from our Github account, that will be useful later:
$ git clone https://github.com/sangahco/docker-machine-cli.git $ cd docker-machine-cli $ chmod a+x *.sh
In order to manage Amazon EC2 Instances set two environment variables, these two keys are generated by Amazon service in order to send request to their API:
export AWS_ACCESS_KEY=myaccesskey export AWS_SECRET=mysecretkey
for more info read this: https://aws.amazon.com/developers/access-keys/
You can put the previous code inside the .bashrc
file inside the user home folder
and than update the user environment with the following command:
$ source ~/.bashrc
$ /bin/sh create-aws-machine.sh <MACHINE NAME>
$ docker-machine ls
Connect to a machine with the following command,
replacing aws1
with the machine name from the previous command:
$ docker-machine env aws1 $ eval $(docker-machine env aws1)
$ docker-machine active
$ docker-machine stop aws1
Important
This command will terminate the instance and will be removed from the Amazon EC2
$ docker-machine rm aws1