Docker-Compose: Service xxx depends on service xxx which is undefined
16,632
No, it's not defined. You have overwritten one services
with the other one.
You should fix the configuration:
version: '3.5'
services:
apache:
build: ./Docker
image: apache:latest
ports:
- "80:80"
restart: always
db:
image: mariadb:latest
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
depends_on:
- "apache"
adminer:
image: adminer
restart: always
ports:
- "8080:8080"
depends_on:
- "db"
networks:
default:
name: frontend-network
Author by
WhoAmI
Updated on June 13, 2022Comments
-
WhoAmI almost 2 years
I'm having this error:
ERROR: Service 'db' depends on service 'apache' which is undefined.
Why is it saying that apache is undefined? I check the indentation. Should be the right one.
version: '3.5' services: apache: build: ./Docker image: apache:latest ports: - "80:80" restart: always networks: default: name: frontend-network services: db: image: mariadb:latest restart: always environment: MYSQL_ROOT_PASSWORD: example depends_on: - "apache" adminer: image: adminer restart: always ports: - "8080:8080" depends_on: - "db" networks: default: name: frontend-network
-
Salma Gomaa over 3 yearsstackoverflow.com/a/38089080/1770571 For external networks