So you created your first container and now you want to share it with the world or be able to pull it from any machine with Docker client running? In this lesson we will setup a repository on DockerHub and push our container to it. For vSphere folks, DockerHub is very similar to a VM template library.
Pre-Reqs:
Signup for a DockerHub account, it’s free!
Enter name and details and click create
- Enter a name for the new repository
- Enter a description
- Click Create
Let’s push your container to this repository. List the local images with the following command
docker images
Run the following command to tag your local image as a docker repository image, NOTE: the item in red should be your docker id
docker tag webserver:latest vmtocloud/webserver:latest
Push the image to DockerHub with the following command NOTE: It may take several minutes to complete uploading
docker push vmtocloud/webserver:latest
Now from any machine running docker or Kubernetes you can run the container with the following
docker run -d -p 80:80 vmtocloud/webserver
One thing to note though is that DockerHub is rate limited, meaning if there are over 100 pulls a day from the same source IP you have to wait a day and the error you get is not real helpful in Kubernetes. Read more about this and how to get around it here. You can also use VMware’s free Harbor Registry to build your own docker hub.
Pingback: Containers 101 – Create a Contaner with Docker | VMtoCloud.com