version: '3.8' services: portainer: image: portainer/portainer-ce:latest command: -H unix:///var/run/docker.sock ports: - "9000:9000" - "9443:9443" volumes: - /var/run/docker.sock:/var/run/docker.sock - portainer_data:/data networks: - portainer_net deploy: placement: constraints: - node.role == manager restart_policy: condition: on-failure replicas: 1 # db: # image: postgres # restart: always # environment: # POSTGRES_PASSWORD: example # volumes: # - pgdata:/var/lib/postgresql/data # networks: # - portainer_net # deploy: # placement: # constraints: # - node.role == manager # restart_policy: # condition: on-failure # replicas: 1 volumes: portainer_data: external: true networks: portainer_net: driver: overlay attachable: true