Does Docker always check that the local image is of the same or lower version as the official Docker Hub repository?

Asked

Viewed 510 times

1

When lifting a new application, you don’t have the image locally, so Docker fetches the image that is the container’s base. Once the image has been downloaded, Docker raises the container. The application is there working. But if there is locally the image that was the basis for another container, if it is old, how does Docker treat this part when lifting the new application? Take the old image, update and run the new container? I’d like to understand this whole process.

1 answer

2


Let’s start with the command run. When rotating docker run ubuntu Docker will check if there is a Ubuntu image locally using the tag :latest. If there is a Docker it will create a container using this image, if not it will perform the docker pull ubuntu:latest and, after that, create the container.

When rotating the command docker pull ubuntu he will check if there is an image of Ubuntu with the tag :latest, if not, it will download the image. If docker pull he finds a local image with the tag :latest then you will download the image signature (a hash in sha256) that is there in Dockerhub and compare it to the signature of your local image, if they are equal it prints on the console something like:

status: Image is up to date for ubuntu:latest

If they are different it will download the new image and mark the old one with the tag <none>, getting something like this:

Repository            tag                 Image ID            CREATED             SIZE
ubuntu               latest              113a43faa138        2 weeks ago         81.2MB
ubuntu               <none>              452a96d81c30        7 weeks ago         79.6MB
  • Uhmmm. Show! Then the new project will use the latest version. If I raise the old project, will it also run based on the last one? Does <None> get parked type, useless? I know it would be another question. But thanks!

  • 1

    when an image gets this tag <none> It does no good, it only takes up disk space because Docker does not use it to generate a new container. If you update an image Docker will always use the newest (the local image with the specified tag) to create new containers.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.