Private Docker Registry Setup Guide
Setting up a Docker private registry can be done using Docker’s official tool, Docker Registry, or third-party tools like Harbor. Here are some simple steps for setting up a private registry using Docker Registry.
- Install Docker Registry.
To install Docker Registry on a server, you can use the official Docker image.
docker run -d -p 5000:5000 --restart=always --name registry registry:2
This command will start a Docker Registry container on the server and map it to local port 5000.
- Set up the Docker client.
Before using a private repository, you need to configure the address of the private repository in the Docker client. Edit the /etc/docker/daemon.json file and add the following content:
{
"insecure-registries": ["your-registry-address:5000"]
}
Then restart the Docker service.
sudo systemctl restart docker
- Using a private repository.
Now you can push the locally built images to a private repository.
docker tag your-image your-registry-address:5000/your-image
docker push your-registry-address:5000/your-image
Images can also be pulled from a private repository.
docker pull your-registry-address:5000/your-image
Here are the simple steps to set up a private repository using Docker Registry, for more advanced features, consider using third-party tools like Harbor.