0

Here's my yml contents.


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:
     -  PGADMIN_DEFAULT_EMAIL=pgadmin4@pgadmin.org
     -  PGADMIN_DEFAULT_PASSWORD=admin
    depends_on:
      - db
    networks:
      - service
    ports:
      - "80:80"

volumes:
  db_data: {}

error message : services.db.environment must be a mapping I'm using the Mac M1 And I have no idea what is wrong .... Does anyone know ??

1 Answers1

0

you are missing the -, you are doing it correct in the pgadmin container

    environment:
      - POSTGRES_USER={###}
      - POSTGRES_PASSWORD={###}
      - POSTGRES_DB={###}
Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
  • It was not only because of the missing - . Actually I was forgotten to write network . ``` networks: service: driver: bridge ``` – yeonsook kwak Feb 03 '23 at 13:09