How to setup private registry
From here.
- Start the registry server
1 | docker run -d -p 5000:5000 --restart=always --name registry registry:2 |
- Make the registry can be accessed by others
Be default if you don’t do the following step, you can only access the registry from “localhost:5000”.
There are several ways to do this in the offical document, here is the simplest. You need to do the
following steps in every client machine who wants to connect to this registry server.
1 | # 1. Edit the client side "/etc/default/docker" file, and add the following |
- Use the registry
From here.
1 | # 0. You need to have a local build image. |
- Set the storage backend
By default, your registry stores its data on the local filesystem, inside the container.
You can set a directory to storge the registry data by running the following command to start the registry:
1 | docker run -d -p 5000:5000 \ |
- Use Compose to start registry server
From here.
Create a “docker-compose.yml” file with the following content in it:
1 | registry: |
Run “docker-compose up -d” to start the registry server.
How to develop with Docker and the registry
- First you need to know how to push and pull images to/from the registry.
1 | # 1. Build the local Docker file. |
- Then you can create a Docker Compose file to leverage the registry:
1 | host: |
- After that you can start the compose file very easily:
1 | # Note the "--allow-insecure-ssl" argument without with docker-compose |