How do I update a docker image when the official repository is updated?
How do I update custom images when I change the DockerFile, or the Dockerfile contains time sensitive informations?
Is it better practice to build new images, or to rebuild exiting ones?
What's the best way to rebuild an existing image?
What's the best way to differentiate multiple builds of the same image?
If you are using the Docker Hub to create an automated build, then you can add a Repository Link which will rebuild your repo when the linked repo updates.
If you want to do the builds yourself, you could create a hacky workaround to get the notification via a link as above and rebuild a trivial repo, then use a Web Hook to notify your build system of the change.
If you are using the Docker Hub for an automated build, then changes to your BitBucket or GitHub source repo, including Dockerfile changes, will trigger a new build.
If you're building images yourself, just type
docker build .
in the directory where your Dockerfile resides. You can use--no-cache
to force a completely fresh rebuildThat depends on who is using your images. When you
build
, the result is always a new image, but how youtag
the result can make it seem like a replacement for the old image or something new.Use the
:tag
feature in the name, egsee https://registry.hub.docker.com/_/ubuntu/ for a complete list of all the variations on the "ubuntu" image. See the
tag
documentation for the complete format for a friendly image name. All tags and names are aliases for the canonical image name, that long UUID-looking string when you rundocker images --no-trunc
.