Publish to Docker Hub

Learn important factors to consider when choosing a Docker registry and how to publish images to Docker Hub.

We can build Docker images once and run them anywhere on local, CI/CD, or production environments. However, to run a Docker image anywhere, it must be stored in a central place where it can be pulled and run whenever we want.

When we create a Docker image on a server, it remains on the host, which means we can’t run it on another computer. The Docker image must be pushed to a Docker registry before it can be pulled and used elsewhere.

In this tutorial, we learn to use Docker Hub to store Docker images.

Choose a container registry

A container registry is a place to store Docker images. This is similar to how a database is a place to store data. It gives a team a central location to handle Docker images, conduct vulnerability assessments, and configure who can access the images. However, not all container registries have the same features and functionality. Therefore, picking the right one isn’t easy.

Availability, automation, and security can all play a role in our decision-making process.

Before going with a Docker registry, we should be able to answer the following:

Availability:

  • What level of service availability does the registry provide? Can we always rely on the registry to pull images when needed?

Security:

  • Is it compatible with a variety of authentication systems and identity providers?
  • What level of security and access does it offer? Does it provide enough fine-grained access to meet our needs?
  • Does it support organization and team accounts?

Automation:

  • What level of automation does it support?
  • Is it compatible with Githook?
  • Are there APIs we can leverage for automation?
  • How compatible is it with our existing infrastructure?
  • How does it integrate with our platform, infrastructure, and cloud provider?

For an enterprise-grade container registry, we should be able to answer these questions.

Get hands-on with 1400+ tech skills courses.