You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

启用no-new-privileges后Traefik容器启动报错:exec操作不允许

Traefik配置启动问题求助

我正在尝试通过以下docker-compose.yml配置Traefik:

version: '3'

services:
  traefik:
    image: traefik:latest
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
    environment:
      # - CF_DNS_API_TOKEN=
      # If you choose to use an API Key instead of a Token, specify your email as well
      - CF_API_EMAIL=myEmail
      - CF_API_KEY=myKey
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /a/b/c/traefik/traefik.yml:/traefik.yml:ro
      - /a/b/c/traefik/acme.json:/acme.json
      - /a/b/c/traefik/config.yml:/config.yml:ro
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`traefik-dashboard-internal.example.com`)"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=user:hash"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.example.com`)"
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"
      - "traefik.http.routers.traefik-secure.tls.domains[0].main=example.com"
      - "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.example.com"
      - "traefik.http.routers.traefik-secure.service=api@internal"

networks:
  proxy:
    external: true

执行sudo docker compose up时出现如下报错:

# traefik is up-to-date
# Attaching to traefik
# traefik    |  exec /entrypoin.sh: operation not permited

我确认该问题由no-new-privileges:true配置导致,将其改为=false后容器可启动,但无法正常工作。

请问该如何解决此问题?我的compose文件是否存在其他错误?

我已尝试以下方案:

  • 使用sudo运行命令
  • 修改traefik相关文件、docker.sock、acme.json、config.yml和localtime的权限与归属
  • 注释掉大部分配置

更新1 - 版本信息

Ubuntu

Distributor ID: Ubuntu
Description:    Ubuntu 23.10
Release:        23.10
Codename:       mantic

Docker

Docker version 26.0.0, build 2ae903e

Docker Compose

Docker Compose version v2.25.0

内容的提问来源于stack exchange,提问作者pb.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 14:47:04