Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker push to the registry with changed Dockerfile and same tag

Imagine, I have docker image based on Dockerfile, I will tag & push it into docker registry

Over time, I change Dockerfile (add/change new instructions, ...)

Now, I will tag new image again with the same tag I used in the first place and push it into docker registry

  1. How does docker registry react to new layers?
  2. How does docker registry react to changed layers?
  3. Will it overwrite existing image with the latest version?
  4. Should I use different tag to make sure I have correct new image in place?
like image 383
Patrik Mihalčin Avatar asked Nov 14 '16 16:11

Patrik Mihalčin


People also ask

Can we push docker image with same tag?

It will function the same as a pull -- unchanged layers will not be pushed again and new layers will be pushed. Will it overwrite existing image with the latest version? Yep.

Does docker tag overwrite?

Currently, if you deploy an image with a user, then try to push the image again (to overwrite it) with no delete/overwrite permissions, the docker client returns a successful message. If you try to overwrite the image/tag with a different image, then there will be an error.

Can same docker image have multiple tags?

A tag must point to a single Docker image but a single Docker image can have many Tags. So let's rebuild the previous image with version:latest tag. In the above case, we built a new image (without modifying the contents) with the name version:latest though we left out :latest part so that Docker can do its magic.


1 Answers

How does docker registry react to new layers? How does docker registry react to changed layers?

It will function the same as a pull -- unchanged layers will not be pushed again and new layers will be pushed.

Will it overwrite existing image with the latest version?

Yep.

Should I use different tag to make sure I have correct new image in place?

Usually. Using latest to represent the most recent is fine but you should add a second tag for the actual version so that dependent systems can pin to that version and upgrade as needed.

like image 154
CashIsClay Avatar answered Sep 19 '22 03:09

CashIsClay