Docker Community Forums

Share and learn in the Docker community.

Docker tagged images dependencies

I’ve tagged my Docker image and pushed it to my Docker repository. Is this tagged image completely independent from its base image and dependencies downloaded from the Dockerfile? I’m looking for a way to not need to rely on images and other dependencies that might be removed by their maintainers.

if you created the image yourself from scratch it shouldn’t have any dependencies, but if you used a base image, it’ll always be associated to it (as far as I know). Also, if you build a completely new image based on the base image, it’ll be cached anyway for each new build. Only solution is to build an entirely new image using the Dockerfile.

@choogster I’m not sure I understand all the Docker terminology. I’m still confused about how the image tagging process works. I’m new to Docker, so this question might not be very clear:

When I build an image, from a Dockerfile and base (parent) image, then tag it then push it to my docker repo, pulling that new image will still need to pull the base (parent) image? Or does that new image now include the base (parent) image? Is this the process you are referring to when you say " build an entirely new image using the Dockerfile"?

When you build a new image using a Dockerfile, it draws in the base image and then builds on top of that. The new image includes the base image so doesn’t need to pull it again.

The tagging is fairly straight forward usually in the format registry/imagename:version for example:
myregistry/myimage:1.0 or if you’re using dockerhub it would be username/imagename:version for example: dockerhubuser/myimage:1.0

If you’ve created your own registry, you would need to put the whole URL in the registry section such as after logging in with the docker login command

All images have one or more dependencies. You can trace the descendants via the FROM instruction starting from your Dockerfile and then the Dockerfile of the image you reference and so on until you reach the original base image (possibly scratch). You can build your own images from the ‘scratch’ image itself, but you would still have this dependency albeit scratch is the most minimal.

All that said, this is really nothing to be overly concerned about. There are a lot of best practice that you can find for optimising your image build, for size and performance.