Publish my Docker Image to my repo.
Samuel Ezeja
Software Engineer | DevOps | Network / Cloud Engineer | NodeJS Full Stack | Zabbix Professional | Team Lead
One of the articles I haven't seen more of it online is: Trying to update an already existing image of Docker Hub.
A scenario is when a code is modified to accommodate updates and is pushed to the VCS - Git, considerations should be the first step every DevOps and Software engineer should look into. Security will not be looked into because like I said - Basic ??.
What is the basic consideration?
For bullet point one, Each of the containers contains different file layers. Each container can be tracked as a representation of a specific commit to a software release. Since git is a reliable means of tracking changes, we can use the log hash as a tag for our containers, before tagging it "latest".
Our images should be versioned, since they will have the same name, but should have different versions - bullet point two. Even as we tag the newest image, we can still look at the previous image using the versioned tag on each image push "--build-arg".
Before we continue, you must have logged into docker on your terminal.
Our assumptions are we already have a copy of the image online.
Let's get something to hold on to track all the files contained in the container. As discussed we will use git has as discussed.
git log -1 - - pretty=%H
#b43f7dc22d5192714ea2dbb4b912b34f34f4d065
Let's tag our image:
领英推荐
docker image build - t [USERNAME]/app-name:[HASH] - - build-arg VERSION=2.0 .
docker image build - t samuel/todo:b43f7dc22d5192714ea2dbb4b912b34f34f4d065 - - build-arg VERSION=2.0 .
Let's tag the image as the latest:
docker image tag [USERNAME]/app-name[HASH] [USERNAME]/app-name:latest
docker image tag samuel/todo:b43f7dc22d5192714ea2dbb4b912b34f34f4d065 samuel/todo:latest
Let's push the images online:
docker image push samuel/todo:b43f7dc22d5192714ea2dbb4b912b34f34f4d065
docker image push samuel/todo:latest
Visit your docker Hub to see the magic.
Your assignment is to push the app using the version (2.0) ?.