-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Docker compose does not handle depends_on #12573
Comments
I think I have the same issue. Pulling my hair out now since 2 hours trying to get a Zabbix Docker Setup running. To make it able to reproduce (I am on Ubuntu 24 LTS with compose v2.33.0), I will provide the files here. When doing a docker-compose.yml services:
server-db-init:
extends:
file: compose_zabbix_components.yaml
service: server-mysql-db-init
image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
mysql-server:
condition: service_started
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
zabbix-server:
extends:
file: compose_zabbix_components.yaml
service: server-mysql
image: "${ZABBIX_SERVER_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
zabbix-web-apache-mysql:
extends:
file: compose_zabbix_components.yaml
service: web-apache-mysql
image: "${ZABBIX_WEB_APACHE_MYSQL_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
volumes:
- /etc/timezone:/etc/timezone:ro
depends_on:
server-db-init:
condition: service_completed_successfully
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
zabbix-snmptraps:
extends:
file: compose_zabbix_components.yaml
service: snmptraps
image: "${ZABBIX_SNMPTRAPS_IMAGE}:${ZABBIX_ALPINE_IMAGE_TAG}${ZABBIX_IMAGE_TAG_POSTFIX}"
labels:
com.zabbix.os: "${ALPINE_OS_TAG}"
mysql-server:
extends:
file: compose_databases.yaml
service: mysql-server
db-data-mysql:
extends:
file: compose_databases.yaml
service: db-data-mysql
networks:
frontend:
driver: bridge
enable_ipv6: "${FRONTEND_ENABLE_IPV6}"
ipam:
driver: "${FRONTEND_NETWORK_DRIVER}"
config:
- subnet: "${FRONTEND_SUBNET}"
backend:
driver: bridge
enable_ipv6: "${BACKEND_ENABLE_IPV6}"
internal: true
ipam:
driver: "${BACKEND_NETWORK_DRIVER}"
config:
- subnet: "${BACKEND_SUBNET}"
database:
driver: bridge
enable_ipv6: "${DATABASE_NETWORK_ENABLE_IPV6}"
internal: true
ipam:
driver: "${DATABASE_NETWORK_DRIVER}"
tools_frontend:
driver: bridge
enable_ipv6: "${ADD_TOOLS_ENABLE_IPV6}"
ipam:
driver: "${ADD_TOOLS_NETWORK_DRIVER}"
config:
- subnet: "${ADD_TOOLS_SUBNET}"
volumes:
snmptraps:
# mysql_socket:
secrets:
MYSQL_USER:
file: ${ENV_VARS_DIRECTORY}/.MYSQL_USER
MYSQL_PASSWORD:
file: ${ENV_VARS_DIRECTORY}/.MYSQL_PASSWORD
MYSQL_ROOT_USER:
file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_USER
MYSQL_ROOT_PASSWORD:
file: ${ENV_VARS_DIRECTORY}/.MYSQL_ROOT_PASSWORD
# client-key.pem:
# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE
# client-cert.pem:
# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE
# root-ca.pem:
# file: ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE
# server-cert.pem:
# file: ${ENV_VARS_DIRECTORY}/.DB_CERT_FILE
# server-key.pem:
# file: ${ENV_VARS_DIRECTORY}/.DB_KEY_FILE compose_databases.yaml services:
mysql-server:
image: "${MYSQL_IMAGE}:${MYSQL_IMAGE_TAG}"
command:
- mysqld
- --skip-mysqlx
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_bin
# Only during upgrade from versions prior 6.4 and new installations (schema deployment)
- --log_bin_trust_function_creators=1
# Use TLS encryption for connections to database
# - --require-secure-transport
# - --ssl-ca=/run/secrets/root-ca.pem
# - --ssl-cert=/run/secrets/server-cert.pem
# - --ssl-key=/run/secrets/server-key.pem
restart: "${RESTART_POLICY}"
attach: false
volumes:
- ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw
- ${ENV_VARS_DIRECTORY}/mysql_init/init_proxy_db.sql:/docker-entrypoint-initdb.d/mysql_init_proxy.sql:ro
# - mysql_socket:/var/run/mysqld/
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_db_mysql
required: true
- path: ${ENV_VARS_DIRECTORY}/.env_db_mysql_override
required: false
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/MYSQL_ROOT_PASSWORD
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
- MYSQL_ROOT_PASSWORD
# - server-key.pem
# - server-cert.pem
# - root-ca.pem
stop_grace_period: 1m
networks:
database:
aliases:
- mysql-server
db-data-mysql:
image: "${BUSYBOX_IMAGE}:${BUSYBOX_IMAGE_TAG}"
volumes:
- ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw compose_zabbix_components.yml services:
server:
init: true
ports:
- name: zabbix-trapper
target: 10051
published: "${ZABBIX_SERVER_PORT}"
protocol: tcp
app_protocol: zabbix-trapper
restart: "${RESTART_POLICY}"
attach: true
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
- ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw
- ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/ssl/certs:/var/lib/zabbix/ssl/certs:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/ssl/keys:/var/lib/zabbix/ssl/keys:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/ssl/ssl_ca:/var/lib/zabbix/ssl/ssl_ca:rw
- snmptraps:/var/lib/zabbix/snmptraps:roz
tmpfs: /tmp
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
deploy:
resources:
limits:
cpus: '0.70'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_srv
required: true
- path: ${ENV_VARS_DIRECTORY}/.env_srv_override
required: false
networks:
database:
aliases:
- zabbix-server
backend:
aliases:
- zabbix-server
frontend:
tools_frontend:
# devices:
# - "/dev/ttyUSB0:/dev/ttyUSB0"
stop_grace_period: 30s
# cap_add:
# - "NET_RAW"
sysctls:
- net.ipv4.ip_local_port_range=1024 64999
- net.ipv4.conf.all.accept_redirects=0
- net.ipv4.conf.all.secure_redirects=0
- net.ipv4.conf.all.send_redirects=0
# - net.ipv4.ping_group_range=0 1995
labels:
com.zabbix.company: "Zabbix SIA"
com.zabbix.component: "server"
server-mysql-db-init:
init: true
attach: true
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
# - mysql_socket:/var/run/mysqld/
command: init_db_only
tmpfs: /tmp
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_db_mysql
required: true
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
networks:
database:
aliases:
- zabbix-server-mysql-init
labels:
com.zabbix.description: "Zabbix server with MySQL database support (database init)"
com.zabbix.dbtype: "mysql"
server-mysql:
extends:
service: server
# volumes:
# - mysql_socket:/var/run/mysqld/
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_db_mysql
required: true
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
networks:
backend:
aliases:
- zabbix-server-mysql
labels:
com.zabbix.description: "Zabbix server with MySQL database support"
com.zabbix.dbtype: "mysql"
web-apache-mysql:
extends:
service: web-apache
# volumes:
# - mysql_socket:/var/run/mysqld/
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_db_mysql
required: true
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
labels:
com.zabbix.description: "Zabbix frontend on Apache web-server with MySQL database support"
com.zabbix.dbtype: "mysql"
web-apache:
profiles:
- all
ports:
- name: web-http
target: 8080
published: "${ZABBIX_WEB_APACHE_HTTP_PORT}"
protocol: tcp
app_protocol: http
- name: web-https
target: 8443
published: "${ZABBIX_WEB_APACHE_HTTPS_PORT}"
protocol: tcp
app_protocol: https
restart: "${RESTART_POLICY}"
attach: false
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro
- ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
tmpfs:
- /tmp
- /var/lib/php/session:mode=770,uid=1997,gid=1995
deploy:
resources:
limits:
cpus: '0.70'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_web
required: true
- path: ${ENV_VARS_DIRECTORY}/.env_web_override
required: false
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/ping" ]
interval: 1m30s
timeout: 3s
retries: 3
start_period: 40s
start_interval: 5s
networks:
database:
backend:
frontend:
stop_grace_period: 10s
sysctls:
- net.core.somaxconn=65535
labels:
com.zabbix.company: "Zabbix SIA"
com.zabbix.component: "frontend"
com.zabbix.webserver: "apache2"
snmptraps:
# Override snmptrapd command arguments to receive SNMP traps by DNS
# It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable
# command: /usr/sbin/snmptrapd -t -X -C -c /etc/snmp/snmptrapd.conf -Lo -A --doNotFork=yes --agentuser=zabbix --agentgroup=zabbix
profiles:
- full
- all
ports:
- name: snmptrap
target: 1162
published: "${ZABBIX_SNMPTRAPS_PORT}"
protocol: udp
app_protocol: snmptrap
restart: "${RESTART_POLICY}"
attach: false
read_only: true
volumes:
- snmptraps:/var/lib/zabbix/snmptraps:rwz
- ${DATA_DIRECTORY}/var/lib/zabbix/snmptrapd_config:/var/lib/zabbix/snmptrapd_config:rw
tmpfs: /tmp
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.25'
memory: 128M
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_snmptraps
required: true
- path: ${ENV_VARS_DIRECTORY}/.env_snmptraps_override
required: false
networks:
frontend:
aliases:
- zabbix-snmptraps
backend:
stop_grace_period: 5s
labels:
com.zabbix.description: "Zabbix snmptraps"
com.zabbix.company: "Zabbix SIA"
com.zabbix.component: "snmptraps" |
Description
In the latest version of Docker Desktop for Mac (Arm arch) Docker compose config does not handle depends_on directives.
Steps To Reproduce
No response
Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: