How to version Docker Images?

If we use git for version management of our code base, similarly we can use Docker as our version management tool for applications.

Lets imagine, we have an application called “Icecream”.

We are going to store our “Icecream” application on a reposi…


This content originally appeared on DEV Community and was authored by Danyson

If we use git for version management of our code base, similarly we can use Docker as our version management tool for applications.

Lets imagine, we have an application called "Icecream".

We are going to store our "Icecream" application on a repository named "Fridge" so, lets get the root access by executing the command

sudo -i
  • First we need to login to our repository called "Fridge"
docker login Fridge
  • Now pull the "Icecream" image from our "Fridge"
docker pull Fridge/Icecream:plain

// syntax: docker pull repo_name/Image_name:version_tag
  • If you don't have a docker image named "Icecream", on our "Fridge" repository, then lets build one
docker build -t Icecream:plain
// this command is executed from the working directory where our docker file is placed
  • Now as we have our "Icecream:plain, lets modify it to "Icecream:vanilla" and "Icecream:chocolate".

  • For that we need to run our Icecream:plain in to a container

docker run -it Icecream:plain bash
  • Add the code for vanilla in our container and do
docker ps
  • copy the container id of the running container and commit
docker commit <container_id> Icecream:vanilla
  • Now run our "Icecream:plain" in to a container again
docker run -it Icecream:plain bash
  • Add the code for chocolate in our container and do
docker ps
  • copy the container id of the running container and commit
docker commit <container_id> Icecream:chocolate
  • Now push the changes to your "Fridge" repository
docker push Icecream:vanilla
docker push Icecream:chocolate

Explore us more on : Doge Algo 🐶


This content originally appeared on DEV Community and was authored by Danyson


Print Share Comment Cite Upload Translate Updates
APA

Danyson | Sciencx (2021-12-28T19:47:37+00:00) How to version Docker Images?. Retrieved from https://www.scien.cx/2021/12/28/how-to-version-docker-images/

MLA
" » How to version Docker Images?." Danyson | Sciencx - Tuesday December 28, 2021, https://www.scien.cx/2021/12/28/how-to-version-docker-images/
HARVARD
Danyson | Sciencx Tuesday December 28, 2021 » How to version Docker Images?., viewed ,<https://www.scien.cx/2021/12/28/how-to-version-docker-images/>
VANCOUVER
Danyson | Sciencx - » How to version Docker Images?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/12/28/how-to-version-docker-images/
CHICAGO
" » How to version Docker Images?." Danyson | Sciencx - Accessed . https://www.scien.cx/2021/12/28/how-to-version-docker-images/
IEEE
" » How to version Docker Images?." Danyson | Sciencx [Online]. Available: https://www.scien.cx/2021/12/28/how-to-version-docker-images/. [Accessed: ]
rf:citation
» How to version Docker Images? | Danyson | Sciencx | https://www.scien.cx/2021/12/28/how-to-version-docker-images/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.