How to publish your docker image in minutes

Business man lazy — image

1. What is Docker Hub?

Docker Hub is a service provided by Docker for finding and sharing container images with your team.

2. Assumptions

You have installed Docker Desktop and have a Docker Hub account, it’s free by the way.

3. Why?

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.

4. Alternatives

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
  • Harbor
  • Google Container Registry
  • Sandboxie
  • 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.

docker hub page

5.1. Dockerfile

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.

Dockerfile

5.2. Build

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 docker login

docker push 16bits/zero2hero-fe:0.0.1
docker push console

7. Browse on docker hub

The image has been uploaded to hub.

8. Katacoda

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/)

Katacoda Docker screen
Image page screen
Pulling the image screen
docker run command
container is running
Default port — screen
Change the port — screen
Application home page
Application screen

9. References

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Luiz Gustavo De O. Costa

Luiz Gustavo De O. Costa

Hey friend!! I’m Luiz Gustavo, a Java developer and I’m here to learn and write about Java, tests and good practices