When working with Docker images, it is always recommended to use the latest image build, and this post will show how to update a Docker image.
Running applications in a stable condition requires a bug-free and secure underlining Docker image. Docker images update cycle is different between various images. However, most of them get updates and new builds.
To check how old is our Docker images we use the docker history command with the name of the image as shown below.
docker history ubuntu:latest
The output is shown below.
IMAGE CREATED CREATED BY SIZE COMMENT 9873176a8ff5 2 months ago /bin/sh -c #(nop) CMD ["bash"] 0B <missing> 2 months ago /bin/sh -c #(nop) ADD file:920cf788d1ba88f76… 72.7MB
To update our image to the latest image build, we run the following command.
docker pull ubuntu
The above code will update the image to the latest image release.