docker-machine and amazonec2 driver
I am writing this post in the hopes that someone searching to solve problems I was facing yesterday will find this post and hopefully reduce the amount of hair being pulled from their head.
Mac OSX El Capitain: version 10.11.16
docker-machine: version 0.8.2
docker: version 1.12.3
RUN apt-get update -y
RUN apt-get install -y python-pip python-dev build-essential
ENV APP_HOME /web
RUN mkdir $APP_HOME
ADD . $APP_HOME
RUN pip install -r requirements.txt
command: python myapp.py
What I was doing:
I had developed a simple Flask application with a sqlite db within my local docker environment and was attempting to deploy to the AWS container service for the first time.
- Specify the ami: The docker-machine command I found on the web in several different places did not specify the ami which meant by default it was using Ubuntu 15.10. docker-machine create -d amazonec2 — amazonec2-access-key ‘<KEY>’ — amazonec2-secret-key <SECRET> — amazonec2-region us-east-1 — amazonec2-subnet-id <SUBNET> — amazonec2-vpc-id <VPC> — amazonec2-zone “b” <MACHINE_NAME> The error I kept receiving was: Error checking and/or regenerating the certs. I finally figured out was that I need to use a different version of Ubuntu. In order to that you need to specify a different ami: docker-machine create -d amazonec2 — amazonec2-access-key ‘<KEY>’ — amazonec2-secret-key <SECRET> — amazonec2-region us-east-1 — amazonec2-subnet-id <SUBNET> — amazonec2-vpc-id <VPC> — amazonec2-zone “b” — amazonec2-ami ami-fce3c696 <MACHINE_NAME>
- Re-run eval to point to the correct docker environment variables: If you are running docker-machine locally and you want to then properly run and deploy to amazonec2 you will need to run: eval “$(docker-machine env <MACHINE_NAME>)” in order to ensure all subsequent commands are running against the active docker-machine.