Docker Repository

  • Post author:
  • Post comments:0 Comments
Download PDF
Advertisement

Docker Repository

The repository allows you to store and access files in the central file storage location. Basically, it is used by version control systems to store multiple versions of files, these files may be source code files and other resources used by the project.

Similarly, Docker repositories allow sharing container images with customers, the Docker community, and across your team. To push “ducker push” command is used to push to Docker hub. Many Docker images (stored as tags) can behold by a single Docker hub repository.

First sign into Ducker Hub to create a repository, click on Repositories and then click on Create Repository.

Create Repository
Create Repository

The repository name must be unique in that namespace. Short Description can be of 100 characters and is used in the search results, while readme for the repository is used as Full Description.

After hitting the “Create” button, you need docker push images to that hub-based repository.

 

Pushing a Docker container image to Docker Hub

Before pushing the repository to the Docker hub, name your local image using your Docker Hub username, and the name of the repository that you created through Docker Hub on the web.

Docker allows you to add multiple images to a repository, by adding a specific :<tag> to it (like docs/base:testing). If it’s not stated, then the tag defaults to the latest.

 

Name your local images by following ways:

  • Either when you build it, using docker build –t <hub-user>/<repo-name>[:<tag>],
  • By re- tagging an existing local image

docker tag <existing-image> <hub-user>/<repo-name>[:<tag>],

  • Or by using docker commit <existing-container> <hub-user>/ <repo-name>[:<tag>] to commit changes.

After this, you can push this repository to the registry designated by its tag or name

$ docker push <hub-user>/<repo-name>:<tag>

The image is now available for use to your team or for the community.

There are two types of repositories:

Advertisement

  • Private
  • Public

 

Private Repositories

Private repositories allow you to keep container images private, it may be within an organization, team, or to your own account.

When creating a repo select Private to create a private repo

Private Repositories
Private Repositories

 

To make an existing repository private go to repo’s settings tab and under visibility, settings select Make Private button.

Make Private
Make Private

 

Docker hub user account only allow one private repository for free, to make more private repositories for your account, upgrade your Docker hub plan.

Once the private repository is created, use Docker to push and pull images to and from it.

Public Repositories

Pubic repositories allow container images to be available publically, to the community, and to everyone from anywhere.

When creating a repo select Public to create a public repo.

 

Collaborators and their role

A collaborator is somebody you want to give access to a private repository. They cannot perform any administrative tasks like changing the repository status from private to public, deleting the repository. Collaborator can’t add other collaborators. Collaborators can only push and pull to your repositories.

You can also give rights to collaborators such as (Admin, Read, Write) on Docker Hub by using organizations and teams.

 

Advertisement

Leave a Reply

Please rate us