As my last note writes, we can make a docker image for personal usage.

making a docker for running perl

But how can we push this iamge to docker hub for public usage? here is the guide.

Frist we need to create an account on docker hub.

Docker hub account management

The registration is simple, just choose an username and use an valid email address.

Here my username is "geekml".

After login into docker hub from web, create a repo under the username. For instance, my repo is "gmbox".

Now we should be able to push images to this repo.

Go to the terminal, let's tag the image made in last note.

 $ docker tag gmbox geekml/gmbox:latest

Here "geekml/gmbox" is the new image name, which consists of username and repo in docker hub. "latest" is tag name for this image.

Every image you push to docker hub should be tagged. The default tag name is 'latest'.

After then we should login into docker hub from terminal. run this command:

 $ docker login

which requires you to input username and password.

After successful login we can make a push by this command:

 $ docker push geekml/gmbox:latest

So let's go to another host and run a pull:

 $ docker pull geekml/gmbox
Using default tag: latest
latest: Pulling from geekml/gmbox
Digest: sha256:7ff01a56dfb8bcb2e3bbf22d896e75bc70c9b9a6d60df85b283ce075d914688b
Status: Downloaded newer image for geekml/gmbox:latest
docker.io/geekml/gmbox:latest

As you see this image has been pulled into local system. Let's check it:

 $ docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
geekml/gmbox latest 111b725bb261 23 hours ago 921MB

Let's run this new image as a container in the host:

 $ docker run -v `pwd`:/home geekml/gmbox perl /home/bin/gmbox.pl johnsmart
johnsmart exists

All done that way!

Return to home | Generated on 09/30/22