Docker is an open-source platform that packages applications for distribution. It gives you a way to combine applications and their dependencies into containers that run in any environment. Docker Hub is a service for sharing those containers. It’s the largest source of containers in the world. If you’ve run a Docker container or built an image, it relied on a component that originated from Docker Hub.
You can publish your images to Docker Hub too. You can create and use any public repository for free, and you can create and share private repos with a paid account. This post will go over how to get started with Docker Hub.
Docker Hub in Action
Let’s take a look at Docker Hub in action.
$ docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
- The Docker client contacted the Docker daemon.
- The Docker daemon pulled the “hello-world” image from the Docker Hub.
- The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
- The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
For more examples and ideas, visit:
Line 2 indicates that my local system didn’t have a copy of the ‘hello-world’ container available. So, on line 3, Docker pulled the image from library/hello-world.
You can see information about this image on Docker Hub here.
Docker’s default behavior, when it can’t find a local copy of an image, is to look on Docker Hub.
You can also store your images there. So you can make your images available to other users too.
Let’s see how.
All you need to start sharing images on Docker Hub is a free account and a repository.
First, create a Docker ID here .
Now you have access to Docker Hub repositories and can look for images from verified publishers and the open-source community.
If you want to share images, you need to create your own repository.
So sign in to Docker Hub with your Docker ID. This will take you to your page.
This user has a few repos already, but you’ll see the same “Create Repository” button. Click it.
Fill out the form and click “Create.” You now have a repository!
Let’s finish up by saving an image to it. First, log in to Docker Hub on your system.
$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don’t have a Docker ID, head over to https://hub.docker.com to create one.
WARNING! Your password will be stored unencrypted in /home/egoebelbecker/.docker/config.json.
Configure a credential helper to remove this warning. See
Then, starting in a new empty directory, create a Dockerfile with your favorite text editor.
Now, build your image and push it to your new repo.
$ docker build -t ericgoebelbecker/mynewrepo .
Sending build context to Docker daemon 2.048kB
Step 1/1 : from hello-world
Successfully built feb5d9fea6a5
Successfully tagged ericgoebelbecker/mynewrepo:latest
$ docker push ericgoebelbecker/mynewrepo
Using default tag: latest
The push refers to repository [docker.io/ericgoebelbecker/mynewrepo]
e07ee1baac5f: Mounted from library/hello-world
latest: digest: sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4 size: 525
Head back to the Docker Hub website, and you’ll see your image.
Start With Docker Hub Today
Docker Hub is the central repository that makes Docker the tool we know and love. Get started with sharing and finding great images today.
Cprime offers a three-day Docker boot camp for you and your team. Get the skills you need to radically simplify application deployment, power up your IT workflow, and more with the power of Docker containerization.