version: "3.9" services: postgres: container_name: postgres_container image: postgres:14.5 environment: POSTGRES_USER: "postgres" POSTGRES_PASSWORD: "postgres" PGDATA: "/var/lib/postgresql/data/pgdata" volumes: - ./data:/var/lib/postgresql/data - ./initdb:/docker-entrypoint-initdb.d ports: - "5432:5432" networks: - postgres restart: unless-stopped deploy: resources: limits: cpus: "1" memory: 4G pgadmin: container_name: pgadmin_container image: dpage/pgadmin4:6 environment: PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-password} PGADMIN_CONFIG_SERVER_MODE: "False" PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" volumes: - ./pgadmin:/var/lib/pgadmin - ./servers.json:/pgadmin4/servers.json ports: - "5555:80" networks: - postgres restart: unless-stopped deploy: resources: limits: cpus: "0.5" memory: 1G networks: postgres: driver: bridge