How to publish your docker image in minutes
Having your local image is awesome, but making your image public is even better. In this article I’ll explain how to push your local docker image to Docker Hub.
1. What is Docker Hub?
Docker Hub is a service provided by Docker for finding and sharing container images with your team.
You have installed Docker Desktop and have a Docker Hub account, it’s free by the way.
To have a repository for your image. What if you want to run outside your local machine or share with someone? The best way is to have a hub for it.
If you don’t want to use docker hub, you can use some of those below
- Amazon Elastic Container Registry (ECR)
- JFrog Artifactory
- Red Hat Quay
- Azure Container Registry
- Google Container Registry
- Nexus Repository Manager
- My laptop (🛑 no, please don’t do it)
5. Hands on
My account has been created at least some months ago, because this I’ve some images, all related to my video tutorials.
The first step to push the image is to have the Dockerfile. In this example you’ll publish a front end part of 16-bits-zero-to-hero project.
If you need more explanation about the Dockerfile, this article will help you.
Once you have the Dockerfile, it’s time to build the image
docker build -t 16bits/zero2hero-fe:0.0.1 .
5.3. Search the image
A way to search the image is using the name of the recently created image and grep, as shown below.
docker image ls | grep 16bits
6. Push to repository
⚠️ First of all verify if you are logged in. You can check typing
With the first step complete, it’s time to push to docker hub. Pay attention to the image tag and your hub. In my case it has to be 16bits.
docker push 16bits/zero2hero-fe:0.0.1
7. Browse on docker hub
The image has been uploaded to hub.
8.1. What is Katacoda?
Katacoda is an incredible e-learning model that uses cloud containerization technologies like Kubernetes and Docker. (https://kuberty.io/blog/what-is-katacoda/)
After accessing the site, search for Docker and then for any scenario.
Start the scenario in order to have a machine. After the machine creation, type on terminal
docker pull 16bits/zero2hero-fe:0.0.1 as shown on the picture below.
Wait until the download finishes.
Voilà, the image is there and we’re ready to run the image. To run the image use the following syntax
docker run --name <alias to container> -p<HOST_PORT>:<CONTAINER_PORT> <IMAGE_ID> or
docker run --name 16bits-ui -p3000:3000 353d6c70b260. Remember, the image id could be different in your machine.
After a while the container is running. Click on the blue link (Katacoda) to access the machine.
Change the default port 80, to the container port, ie, 3000 and hit the button Display Port.
It’s a kind of magic and the application is up and running. Since we don’t have the backend running we cannot SIGN IN, and go further.
GitHub - luizgustavocosta/16-bits-zero-to-hero: Java project to show how to run front-end (React)…
🗒 Zero to hero 🚀 using React and SpringBoot Create a project with front-end and back-end to run easily locally or…
How to dockerize Spring Boot + React apps
A long time ago we lived in a land without a container, but we had (we still have) a bunch of servers and dedicated…
Playground | loodse | Katacoda
Start using Docker with docker. Launch containers with docker run redis. Use CTRL + c to stop the running container…
Container Fundamentals using Interactive Browser-Based Labs | Katacoda
Learn the latest technologies with our hands-on labs
Top 10 Docker Alternatives 2022 | G2