Push docker image to docker hub

1. Pull the Ubuntu image

First you should be pulled docker image from docker hub registry.

Pull Ubuntu docker image.

After that you can list all the docker images like this.

You can docker images by using

Get latest Ubuntu image.

2. Run Ubuntu docker image

After you can run that Ubuntu docker container like this.

That running Ubuntu docker container is working like Ubuntu virtual machine.

Run Ubuntu image

After that we can list all the running containers.

Moreover we can list all the stopped containers.

Listed running containers

3. Execute docker container

Earlier I mentioned that running Ubuntu docker container is working like Ubuntu virtual machine. So you can log into that Ubuntu container.

After that process you can do any thing inside it.
Here we listed all the files by using “ls” command. “ls” is Linux command. You can use any Linux commands inside this Ubuntu container.

Listed all the files

We created new directory inside that Ubuntu container by using “mkdir” command.

4. Commit changes

We did few changes inside that Ubuntu container. So we must save all the changes.

“docker commit ” is create new docker image by including all the changes.

Create new docker image

This is the newly created docker image.

new docker image

5. Push docker image to docker hub registry

We use “docker push” command for adding new image to docker hub.

docker push command

When we try to push docker image to docker hub it is denied. In this case it may be,

  1. docker doesn’t know where the exactly location is.
    So you must have an docker hub registry account.
After registration this is a docker hub dashboard

2. public repository is not exist.

Here, public repository is “test”. But we have only one namespace called “pramodshehan” in my docker hub registry.
Docker try to push that docker image to public repository called “test”. But public repository called “test” is not exist. That is why it may be denied.

public repository name is displayed within red color rectangle.

6. Login docker hub registry.

Here we used “docker login” to login to docker registry.

docker login

After login, you can push that image to docker registry. Now docker know where the exactly location is.

push docker image again after login

After pushing, you can see new image in you docker hub registry.

docker registry dashboard