Docker-compose autostart issues

Hi,

I’m not sure if this is the place to ask, but here it goes. I have a docker-compose.yaml to start about a dozen containers. I made cron job that runs it at boot (after network).

[Unit]
Description=My Miscellaneous Service
After=network.target docker.service

[Service]
Type=simple
User=aephir
WorkingDirectory=/home/aephir/docker
ExecStart=/home/aephir/docker/docker-compose up -d
Restart=always # or on-failure, on-abort, etc

[Install]
WantedBy=multi-user.target

The thing is, when rebooting, there are always a few containers that do not start. I have to manually run docker-compose up -d after boot. One that never starts automatically is duckdns.
Part of my docker-compose.yaml:

version: '3'
services:
  duckdns:
    container_name: DuckDNS
    image: linuxserver/duckdns
    # depends_on:
      # - letsencrypt
      # - home-assistant
    ports:
      - 8080:80
    environment:
      - PUID=1000
      - PGID=1004
      - SUBDOMAINS=SECRETDOMAIN
      - TOKEN=SECRETTOKEN

I’m sure the docker-compose works, since I can run it. But I am very perplexed as the why some containers in the docker-compose don’t start at boot, while others do.

Any ideas?

I’m running Ubuntu Server LTS 18.04.

1 Like