What are the steps to set up a private Docker registry?
Setting up a private repository allows you to store and manage Docker images locally for improved development and deployment. Here are the steps to set up a private repository:
- To install Docker: Firstly, you need to install Docker on your server. You can follow the official documentation to guide you through the installation process.
- Download images from a private repository: Run the following command to download images from a private Docker repository:
docker pull registry:latest
- Run the private repository container: Use the following command to start the private repository container:
docker run -d -p 5000:5000 --name registry registry:latest
- The htpasswd tool
docker run -d -p 5000:5000 --name registry -v /path/to/htpasswd:/auth/htpasswd registry:latest
- The configuration file for Docker located in the /etc/docker/daemon.json directory.
{
"insecure-registries": ["your-registry-domain:5000"]
}
- Push the image to a private repository: Use the following command to push your Docker image to a private repository:
docker tag your-image your-registry-domain:5000/your-image
docker push your-registry-domain:5000/your-image
You have successfully set up a private repository, and can now use it to store and manage your Docker images.