Skip to content

Tips and Tricks

Kim Oliver Drechsel edited this page Jul 15, 2025 · 13 revisions

Some Tips and Tricks for using application.

Removing a container service

You can add the scale: 0 option in the docker-compose.yml file to remove a service (container). The scale option sets the number of containers to run for the service. Setting it to 0 will scale the service down to zero containers.

Tip

If you set the scale: 0 option to all services in the docker compose file, the entire project will be stopped and removed, excluding any volumes, networks, and images (To delete volumes, networks, and images, you can use the destroy option in the deployment configuration file (See Destroy settings)).

Example

In this example, we add the scale: 0 option to the webserver service and push the change to the repository. The webhook will then trigger the deployment, which will stop and remove the container for the webserver service.

services:
  webserver:
    scale: 0  # Add this line to remove the service remotely
    image: nginx

Access to 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.

  1. code your credentials to base64 (here we use printf to avoid the trailing newline, you can also use echo -n):

    printf 'username:password' | base64
  2. Then create a file called docker-config.json that contains the authentication information in JSON format:

    {
        "auths": {
            "my.registry.example": {
                "auth": "(base64 output here)"
            }
        }
    }
  3. Lastly, add the config file as secret and mount it to /root/.docker/config.json:

    services:
      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:

Clone this wiki locally