skip to Main Content

I have a Docker Compose file with 5 services, a volumes section with 4 volumes, and a custom network section. It uses environment variables and a .env file. Here’s the structure:

version: '3.8'
name: webapp

services:
  redis:
    image: utopia:5000/redis
    hostname: ${HOSTNAME}
    networks:
      webui:
        ipv4_address: 172.17.0.3

  scheduler:
    image: utopia:5000/scheduler:${TAG}
    hostname: ${HOSTNAME}
    dns_search:
      - ${DNSDOMAINNAME}
    restart: on-failure:5
    depends_on:
      - engine
    networks:
      webui:
        ipv4_address: 172.17.0.4
    volumes:
      - sw:/sw
      - decks:/var/decks
      - list:/var/share
      - /dev/log:/dev/log

  celery:
    image: utopia:5000/celery:${TAG}
    hostname: ${HOSTNAME}
    dns_search:
      - ${DNSDOMAINNAME}
    restart: on-failure:5
    depends_on:
      - scheduler
    networks:
      webui:
        ipv4_address: 172.17.0.5
    volumes:
      - sw:/sw
      - decks:/var/decks
      - list:/var/share
      - /dev/log:/dev/log

  webgui:
    image: utopia:5000/webgui:${TAG}
    hostname: ${HOSTNAME}
    dns_search:
      - ${DNSDOMAINNAME}
    restart: on-failure:5
    depends_on:
      - celery
    networks:
      webui:
        ipv4_address: 172.17.0.7
    volumes:
      - sw:/sw
      - decks:/var/decks
      - list:/var/share
      - /dev/log:/dev/log

  engine:
    image: utopia:5000/engine:${TAG}
    hostname: ${HOSTNAME}
    dns_search:
      - ${DNSDOMAINNAME}
    restart: on-failure:5
    depends_on:
      - redis
    networks:
      webui:
        ipv4_address: 172.17.0.2
    volumes:
      - sw:/sw
      - decks:/var/decks
      - list:/var/share
      - /dev/log:/dev/log

volumes:
  sw:
    driver: local
    driver_opts:
      type: nfs
      o: ${SWADDR}
      device: "${SWDEVICE}"
  list:
    driver: local
    driver_opts:
      type: nfs
      o: ${LISTADDR}
      device: "${LISTDEVICE}"
  decks:
    driver: local
    driver_opts:
      type: none
      device: ${DECKS}
      o: bind

networks:
  webui:
    ipam:
      config:
        - subnet: 172.17.0.0/24

All services start correctly except for engine, which does not get the assigned IP address, hostname, or volumes mounted. When I inspect the service with docker inspect, all the values are present but not reflected in the running container.

Here are the troubleshooting steps I’ve tried:

  1. Ensured consistent whitespace in the YAML file.
  2. Changed the order of services in the file.
  3. Tried using only engine and its dependent service.
  4. Replaced environment variables with hard-coded values.

Interestingly, if engine is the only service in the file, it gets the correct values. What could be causing this issue and how can I resolve it?

2

Answers


  1. Chosen as BEST ANSWER

    So rebuilding without --no-squash solved the issue. I have no idea why.


  2. If the IP address is not assigned, then most probably it is already taken. Have you tried to set a different IP address? You may also try a different CIRD, e.g. 172.17.10.0/24.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search