In this lesson, we are going to discuss how to create and manage tags associated with the Docker images. Then we are going to publish a sample Docker image to Docker Hub and consume it on a separate machine.

In the previous lessons, we learned about the anatomy of Docker images, how Docker containers work, how to create a Docker image from a Dockerfile, and learned a few characteristics of Docker images. However, we did not focus on sharing a Docker image with the world. In this lesson, we are going to learn just that as well as Docker image tags.

For this lesson, we are going to create a simple Docker image that prints a version number to the console when a container is created from it. The source code for this application is located in this GitHub repository.

docker-version-app/ 
├── .dockerignore
├── .gitignore
├── Dockerfile
└── version.txt

Our Docker image will look really simple. We are going to have a Dockerfile and version.txt file that contains a version string. The Dockerfile has the CMD instruction that prints the content of the version.txt file. Since this operation doesn’t need a complicated setup, we will use the alpine:3.12.2 image as the parent image for our Docker image.

#programming #dockerhub #docker #dockerfiles #devops

Understanding Docker image tags and publishing images to Docker Hub
1.30 GEEK