这是我的 yml 内容。
version: '2.2'
services:
# postgres
# https://hub.docker.com/_/postgres
db:
container_name: postgres
platform : linux/amd64
image: "postgres:14.6-alpine"
restart: always
environment:
POSTGRES_USER={###}
POSTGRES_PASSWORD={###}
POSTGRES_DB={###}
volumes:
- db_data:/users/a/documents/docker_db/
networks:
- service
ports:
- "5432:5432"
# Container Deployment
#https://www.pgadmin.org/docs/pgadmin4/6.10/container_deployment.html
# https://hub.docker.com/r/dpage/pgadmin4/
pgadmin:
platform : linux/amd64
container_name: pgadmin4_container
image: dpage/pgadmin4
restart: always
environment:
- [email protected]
- PGADMIN_DEFAULT_PASSWORD=admin
depends_on:
- db
networks:
- service
ports:
- "80:80"
volumes:
db_data: {}
错误消息:services.db.environment 必须是映射我正在使用 Mac M1 但我不知道哪里出了问题....有人知道吗?
答案1
你错过了-
,你在 pgadmin 容器中做得正确
environment:
- POSTGRES_USER={###}
- POSTGRES_PASSWORD={###}
- POSTGRES_DB={###}