nschildre
nschildre

Reputation: 31

Confused about pushing Docker image to Dockerhub

Docker newbie here: I have my local development environment set up with Docker desktop on OSX. When I want to push my Docker image to Dockerhub and I am updating the Dockerfile do I need to relaunch my container or is that not necessary? When I update the Dockerfile, tag it with the "latest" tag and push it to Dockerhub and then try to pull it into Kubernetes through Drone it seems to constantly be the old Docker image. At least Drone or Kubernetes are not loading the newest version. Can I access the actual Dockerfile on Dockerhub to double check if it has been pushed correctly?

Upvotes: 1

Views: 211

Answers (1)

Yaron Idan
Yaron Idan

Reputation: 6765

When tagging images, the best practice is setting a separate tag for each new version (using semantic versioning, commit hash or any other system that suites you) rather than using the latest.
Using the latest tag can create unforeseen consequences as pods are rescheduled across your cluster and can lead to disparate versions running concurrently.

If you do insist on using the latest version, you can set the imagePullPolicy of your deployment to Always, which will prompt k8s to try and pull the current version of the image, even if it's already present on the machine. See more details in the k8s docs.

Upvotes: 1

Related Questions