O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it…

Login into an EC2 instance and execute the docker run command to create and run a Docker container from arpitaggarwal/golang-image, assigning the container name as golang-container, using the --name flag, as follows:

$ docker run -d -p 80:8080 --name golang-container -it arpitaggarwal/golang-image 8a9256fcbffc505ad9406f5a8b42ae33ab3951fffb791502cfe3ada42aff781e

The -d flag specified in the docker run command starts the container in a daemon mode and the hash string at the end represents the ID of the golang-container. The -p flag specified in the docker run command publishes a container's port(s) to the host. As we have an HTTP server running on port 8080 inside a Docker container and we opened port 80 for inbound traffic of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required