version: '3.8'
services:
  portainer:
    container_name: portainer
    image: portainer/portainer-ce:latest
    restart: unless-stopped
    command: --admin-password '${PASSWORD_PORTAINER}'
#    ports:
#      - "9000:9000"
    logging:
      options:
        max-size: '12m'
        max-file: '5'
      driver: json-file
    labels:
      - traefik.enable=true
      - traefik.http.routers.portainer.rule=Host(`${URL_PORTAINER}`)
      - traefik.http.routers.portainer.entrypoints=websecure
      - traefik.http.routers.portainer.tls=true
      - traefik.http.routers.portainer.tls.certresolver=lets-encrypt
      - traefik.http.services.port.loadbalancer.server.port=${PORT_PORTAINER}
    networks:
      - traefik-proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - dataportainer:/data

networks:
  traefik-proxy:
    external:
      name: ${NETWORK_PORTAINER}

volumes:
  dataportainer:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_PORT}
      o: bind
