How to do it...

Execute the docker run command to create and run a Docker container from the golang-image, assigning the container name as golang-container using the -name flag, as follows:

$ docker run -d -p 8080:8080 --name golang-container -it golang-image 9eb53d8d41a237ac216c9bb0f76b4b47d2747fab690569ef6ff4b216e6aab486

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.

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.