Build Docker Images

You will access to ecsworkshop Cloud9 to build cats and dogs docker images using Docker CLI.

  1. Move to AWS Cloud9. Select ecsworkshop and click Open IDE.

  2. Build cats, dogs docker images using Dockerfile, which is a text file that contains all the commands a user could call on the command line to assemble an image. For instance, Dockerfile under cats directory will be executed when you build cats docker image. Use linux cat commands to review.

cd ecsworkshop/cats 
cat Dockerfile

Find what FROM, RUN and others mean here. For instance, he FROM instruction initializes a new build stage and sets the Base Image for subsequent instructions.


  1. Build cats.
docker build -t cats . 


  1. Move to dogs directory and review Dockerfile. The contents are similar to cats Dockerfile.
cd ..
cd dogs
cat Dockerfile 


  1. Build dogs. Because you already pulled nginx image, installed and upgrade softwares, the layers are cached so building dogs is much faster than building cats image.
docker build -t dogs .