Private Container Registries¶
To access a private container registry, you need to provide the credentials by adding the docker config file ~/.docker/config.json to the doco-cd container.
Mounting an existing docker config file¶
You can mount your existing ~/.docker/config.json file from the host to the container if you have already added the credentials using docker login on the host machine.
How to add credentials using docker login
Run docker login to add the credentials to the config file:
If the login is successful, the credentials will be stored in the ~/.docker/config.json file on your host machine. You can then mount this file to the doco-cd container to allow it to access the private registry.
Mount the config file to the container:
services:
app:
container_name: doco-cd
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- data:/data
- ~/.docker/config.json:/root/.docker/config.json:ro
Using a custom docker config file¶
-
Encode your credentials to base64 (here we use
printfto avoid the trailing newline, you can also useecho -n): -
Then create a file called
docker-config.jsonthat contains the authentication information in JSON format: -
Lastly, add the config file as secret and mount it to
/root/.docker/config.json:docker-compose.ymlservices: app: container_name: doco-cd image: ghcr.io/kimdre/doco-cd:latest restart: unless-stopped ports: - "80:80" # Webhook endpoint - "9120:9120" # Prometheus metrics environment: TZ: Europe/Berlin GIT_ACCESS_TOKEN: xxx WEBHOOK_SECRET: xxx volumes: - /var/run/docker.sock:/var/run/docker.sock - data:/data secrets: - source: docker-config target: /root/.docker/config.json secrets: docker-config: file: docker-config.json volumes: data: