在新的 docker/docker compose 安装上运行 portainer

在新的 docker/docker compose 安装上运行 portainer

这是我的 .env 文件:

PUID=1000
PGID=1000
TZ="Europe/Paris"
USERDIR="/home/sylvain"
DOCKERDIR="/home/sylvain/docker"
DATADIR="/srv/storage"

这是我的作曲家文件:

version: "3.9"

################ NETWORKS
# You may customize the network subnet (192.168.89.0/24) below as you please.
# Docker Compose version 3.5 or higer required to define networks this way.

networks:
  default:
    driver: bridge
  npm_proxy:
    name: npm_proxy
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.89.0/24
########################### EXTENSION FIELDS
# Helps eliminate repetition of sections
# More Info on how to use this: https://github.com/htpcBeginner/docker-traefik/pull/228

# Common environment values
x-environment: &default-tz-puid-pgid
  TZ: $TZ
  PUID: $PUID
  PGID: $PGID

# Keys common to some of the core services that we always to automatically restart on failure
x-common-keys-core: &common-keys-core
  security_opt:
    - no-new-privileges:true
  restart: always

# Keys common to some of the dependent services/apps
x-common-keys-apps: &common-keys-apps
  networks:
    - npm_proxy
  security_opt:
    - no-new-privileges:true
  restart: unless-stopped

# Keys common to some of the services in media-services.txt
x-common-keys-media: &common-keys-media
  networks:
    - npm_proxy
  security_opt:
   - no-new-privileges:true
  restart: "no"

################# SERVICES
services:
  portainer:
    <<: *common-keys-core
    container_name: portainer
    image: portainer/portainer-ce:latest
    command: -H unix:///var/pun/docker.sock
    #command: -H tcp://socket-proxy:2375 # Use this instead, if you have Socket Proxy enabled.
    ports:
      - 9000:9000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - $DOCKERDIR/appdata/portainer/data:/data
    environment:
      - TZ=$TZ

当我启动 portainer 时,我有以下日志:portainer | 2022-08-14T18:33:47.367944332Z time="2022-08-14T18:33:47Z" level=fatal msg="Failed validating flags:Unable to locate Unix socket or named pipe"

我开始于:sudo docker compose -f ~/docker/docker-compose.yml up -d 我使用以下方式查看日志:sudo docker compose -f ~/docker/docker-compose.yml logs -tf --tail="50" portainer

我认为我的问题在于我按照教程使用 Nginx 代理管理器 (NPM),但我尝试不使用它(我家里有 5G 互联网)。我的配置有什么问题?

答案1

如果您在定义 Portainer 服务时没有注释命令行,请取消注释。这将允许 Portainer 使用 Unix 套接字。总之,应该取消注释以下行。

-H unix:///var/pun/docker.sock

或者,

如果您启用了套接字代理。这应该可以工作。

-H tcp://socket-proxy:2375

看看这个:Portainer Docker Compose

相关内容