Docker - Install a Docker Registry

by
Jeremy Canfield |
Updated: August 12 2021
| Docker articles
This assumes you have installed Docker on Linux and Docker is running.
The docker run command can be used to pull down the registry image (if it has not yet been pulled down), to create the registry container (if it has not yet been created), and to start the container. Let's break down this command.
- The docker run command is used.
- The --detach flag is used to run the registry container in the background.
- The --publish option is used to configure the registry to listen on port 5000 in the container and on the Docker server.
- The --name option is used to give the TBD a specific name.
- The registry:latest image is used.
docker run --detach --publish 5000:5000 --name docker.registry.example.com --restart=always registry:latest
After this completes, the docker images command can be used to see that the registry:latest image was pulled down.
~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry latest 1fd8e1b0bb7e 3 months ago 26.2MB
And the docker container command can be used to see that the container is up and running.
~]# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
44016f5346e3 registry:latest "/entrypoint.sh /etc…" 4 hours ago Up 4 hours 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp
You can now use the docker push command to push images to your registry, and the docker pull command to pull images from your registry.
Did you find this article helpful?
If so, consider buying me a coffee over at