2. Install Docker

In this step, you will install Docker. This is required for the next step to build a container and push it to Amazon ECR.

You will also step through the procedure below, but you can also find the instructions to install docker by following this guide and ensure that the pre-requisites shown on this page are fulfilled.

To install Docker

  1. Connect to your EC2 instance or open Cloud9.
  2. Install the most recent Docker Engine package.
sudo amazon-linux-extras install docker

Skip step 3 if using Cloud9. Go directly to step 4.

  1. Add the ssm-user to the docker group so you can execute Docker commands without using sudo.
sudo usermod -a -G docker ssm-user
  1. Start the Docker service.
sudo service docker start

Skip step 5 if using Cloud9. Go directly to step 6.

  1. Choose Terminate and Connect to pick up the new docker group permissions. Your new session will have the appropriate docker group permissions.

  2. Verify that the you can run Docker commands without sudo.

docker info

Now you have successfully installed Docker.

Next Steps

Continue to the next section to build and push the container.