Pulling a Docker image on an AWS EC2 instance from Docker Hub

To run a Docker container, we need to have a Docker image, which we can either build from a DockerFile or can pull from any of the public or private Docker registries, such as Docker Hub, Quay, Google Container Registry, AWS Container Registry, and so on.

As we have already learned how to create a Docker image from a DockerFile and push it to Docker Hub in Chapter 9, Working with Go and Docker, we will not build an image again in this recipe. Instead, we will be pulling the pre-built image from Docker Hub on an EC2 instance.

See the Building your first Go Docker image recipe in Chapter 9, Working with Go and Docker.

Get Go Web Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.