nicq
nicq

Reputation: 2314

Docker: updating image and registry

What is the right workflow for updating and storing images?

For example:

  1. I download source code from GitHub (project with Docker files, docker-compose.yml)
  2. I run "docker build"
  3. And I push new image to Docker Hub (or AWS ECR)
  4. I make some changes in source code
  5. Push changes to GitHub
  6. And what I should do now to update registry (Docker Hub)?

A) Should I run again "docker build" and then push new image (with new tag) to registry?

B) Should I somehow commit changes to existing image and update existing image on Docker Hub?

Upvotes: 0

Views: 933

Answers (1)

Yves Nicolas
Yves Nicolas

Reputation: 7901

This will depend on what for you will use your docker image and what "releasing" policy you adopt.

My recommendation is that you sync the tags you keep on Docker Hub with the release/or tags you have in GitHub and automate as much as you can your production with a continuous integration tools like Jenkins and GitHub webooks.

Then your flow becomes :
You do your code modifications and integrate them in GitHub ideally using a pull request scheme. This means your codes will be merged into your master branch. Your Jenkins is configured so that when master is changed it will build against your docker file and push it to Docker hub. This will erase your "latest" tag and make sure your latest tag in docker hub is always in sync with your master release on GitHub

If you need to keep additional tags, this will be typical because of different branches or releases of your software. You'll do the same as above with the tag hooked up through Jenkins and GitHub webhooks with a non-master branch. For this, take a look at how the official libraries are organized on GitHub (for example on Postgres or MySQL images).

Upvotes: 2

Related Questions