How Docker Repository works

If you have looked into Docker, you will have heard about the Docker Repository and may have wondered what it is. Make yourself comfortable as we explain everything in detail in this mini guide.

A Docker repository is a container that contains one or more Docker images relating to a particular piece of software or project. Why are there multiple Docker images if the software is the same? Because you can have multiple versions of a piece of software.

Each time the software developer releases a new version, it creates a new Docker Image, with the same name, but with a different version number. This image is then published in the same repository.

To assign a new version number to a Docker image simply assign a tag at build time, for example:

$ docker build. -t 1.0.0

Alternatively, you can use the Docker tag command:

$ docker tag <image-name> <image-name>:<tag>

What is a Docker Repository for?

The repository is a container that can be local or remote. A remote repository is used to make your application image available to other users. Users with permission to access the repository will be able to download a copy of the image uploaded to the repository on their hosts. You can do this using the Docker pull command:

$ docker pull <repository>:<tag>

Who can access the Repository?

Repositories can be public or private. Public repositories are accessible by anyone. There are hundreds of repositories open to the public that can be downloaded freely, without authentication.

To create a private repository, you need to open an account with a supplier (or Docker Registry) such as Docker Hub or Amazon Web Service (via the ECR service), and then create a new repository and grant access to your collaborators.

Docker Registries are repository aggregators. Docker Hub is the most common registry used to download public images.

Each service has its own authentication system, which normally involves using the Docker login command:

$ docker login -p <password> -u <username>

Once logged in, it is possible to pull the images to which access has been granted.

Other resources you might be interested in

We advise you to make a shortcut to the official Docker website. You can find a lot of useful resources there for free.

In conclusion

We hope we have clarified what a Docker Repository is and how to take advantage of it.

Creating an account on a Docker Registry allows you to share an application with your collaborators quickly and easily. You can also log a version history, to guarantee backward compatibility.

Cloud resource providers such as Google Cloud, Azure, and AWS offer this type of service and facilitate integration with their Docker orchestration services. We will cover this topic in more detail in the next few articles on our blog.

Docker is a vital tool for developers who want to grow and improve day by day. Take a look at our mini guide on Docker, how to create a container with Docker and how to create an environment with Docker.

Read related articles