Netbox Docker – Services.netbox-housekeeping.depends_on contiene un tipo no válido, debe ser una matriz

2 minutos de lectura

Avatar de usuario de J-B02
J-B02

SO: Debian Bullseye Docker Versión: 20.10.5+dfsg1, compilación 55c4c88 Docker-Compose Versión: 1.25.0, compilación desconocida Docker-Py Versión: 4.1.0 Versión de CPython: 3.9.2 Versión de OpenSSL: 1.1.1n 15 de marzo de 2022

Intentar configurar Netbox usando Docker Compose y encontrar el siguiente error después de intentar una docker-compose pull dominio.

ERROR: The Compose file './docker-compose.yml' is invalid because:
services.netbox-housekeeping.depends_on contains an invalid type, it should be an array
services.netbox-worker.depends_on contains an invalid type, it should be an array

Aquí está mi archivo docker-compose:

version: "3.4"
services:
  netbox: &netbox
    image: netboxcommunity/netbox:${VERSION-v3.4-2.4.0}
    depends_on:
    - postgres
    - redis
    - redis-cache
    env_file: env/netbox.env
    user: "unit:root"
    healthcheck:
      start_period: 60s
      timeout: 3s
      interval: 15s
      test: "curl -f http://localhost:8080/api/ || exit 1"
    volumes:
    - ./configuration:/etc/netbox/config:z,ro
    - ./reports:/etc/netbox/reports:z,ro
    - ./scripts:/etc/netbox/scripts:z,ro
    - netbox-media-files:/opt/netbox/netbox/media:z
  netbox-worker:
    <<: *netbox
    depends_on:
      netbox:
        condition: service_healthy
    command:
    - /opt/netbox/venv/bin/python
    - /opt/netbox/netbox/manage.py
    - rqworker
    healthcheck:
      start_period: 20s
      timeout: 3s
      interval: 15s
      test: "ps -aux | grep -v grep | grep -q rqworker || exit 1"
  netbox-housekeeping:
    <<: *netbox
    depends_on:
      netbox:
        condition: service_healthy
    command:
    - /opt/netbox/housekeeping.sh
    healthcheck:
      start_period: 20s
      timeout: 3s
      interval: 15s
      test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1"

  # postgres
  postgres:
    image: postgres:15-alpine
    env_file: env/postgres.env
    volumes:
    - netbox-postgres-data:/var/lib/postgresql/data

  # redis
  redis:
    image: redis:7-alpine
    command:
    - sh
    - -c # this is to evaluate the $REDIS_PASSWORD from the env
    - redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
    env_file: env/redis.env
    volumes:
    - netbox-redis-data:/data
  redis-cache:
    image: redis:7-alpine
    command:
    - sh
    - -c # this is to evaluate the $REDIS_PASSWORD from the env
    - redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
    env_file: env/redis-cache.env
    volumes:
    - netbox-redis-cache-data:/data

volumes:
  netbox-media-files:
    driver: local
  netbox-postgres-data:
    driver: local
  netbox-redis-data:
    driver: local
  netbox-redis-cache-data:
    driver: local

He estado usando el siguiente artículo como guía:
https://computingforgeeks.com/how-to-run-netbox-ipam-tool-in-docker-containers/

Tuve el mismo problema en Ubuntu 20.04.5. La solución para mí fue eliminar la instalación de la ventana acoplable e instalarla usando el repositorio de la ventana acoplable.
https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository

Creo que el error se debe a la versión antigua de Docker Compose.

¿Ha sido útil esta solución?