This write-up will explain how to update images in Docker to the latest version.
How to Update Docker Images to the Latest Version?
To update the images to the newest or latest version in Docker, utilize the Docker Hub official registry. For this purpose, first, log in to the Docker Hub registry and pull the image of your desired version or the latest version. For the demonstration, check out the provided instructions.
Step 1: Log in to Docker Hub
To log in to Docker, first, open up your favorite Windows terminal and run the “docker login” command. This command prompts you to enter the user-name and password of your Docker Hub account:
We have already logged in to Docker Hub. Therefore, we are not prompted to enter login credentials:
Step 2: Pull Image With the Version
Next, pull any version of an image from Docker Hub. For instance, we have pulled “mysql:5.7” using the provided command:
For confirmation, list the images and check if the image has been pulled or not:
Step 3: Inspect Image
Inspect the image to check the version of the image. For this purpose, utilize the “docker inspect” command along with the image id:
From the output, you can see we are using the “5.7” version of the “mysql” image:
Step 4: Update Image Version to Latest
In order to update the image to the latest version, pull the image using the “<image-name>:latest” syntax as follows:
Again, list down the images and check if the image of the latest version has been pulled. The “Tag” column is showing the detail of the image version:
However, you can inspect the image using its id and verify if the image has been updated to the latest version or not:
Here, you can see, our images have been upgraded to the “8.0” version:
Users can navigate the Docker Hub repository from the browser and check the images and available versions:
This is all about how to update the Docker images to the latest version.
Conclusion
Thousands of images are published on the Docker Hub registry. Users can easily access the image of any version from the Docker Hub official registry. In order to update the image to the latest version, first, log in to the Docker Hub account. Then, utilize the “docker pull <image:latest>” command. This write-up has demonstrated how to update the Docker image to the latest version.