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 we 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 🐶
Support Us on Buy Me a Coffee
Top comments (0)