gpt4 book ai didi

docker - 为什么在运行sudo docker-compose up时出现权限错误?

转载 作者:行者123 更新时间:2023-12-02 18:18:44 28 4
gpt4 key购买 nike

当我运行docker-compose up时,出现此错误:

Traceback (most recent call last): File "docker-compose", line 6, in File "compose/cli/main.py", line 71, in main File "compose/cli/main.py", line 127, in perform_command File "compose/cli/main.py", line 1085, in up File "compose/cli/main.py", line 1081, in up File "compose/project.py", line 527, in up File "compose/service.py", line 360, in ensure_image_exists File "compose/service.py", line 1084, in build File "site-packages/docker/api/build.py", line 159, in build File "site-packages/docker/utils/build.py", line 30, in tar File "site-packages/docker/utils/build.py", line 49, in exclude_paths File "site-packages/docker/utils/build.py", line 214, in rec_walk File "site-packages/docker/utils/build.py", line 214, in rec_walk File "site-packages/docker/utils/build.py", line 214, in rec_walk File "site-packages/docker/utils/build.py", line 184, in rec_walk PermissionError: [Errno 13] Permission denied: '/usr/sbin/authserver' [6560] Failed to execute script docker-compose



当我运行 sudo docker-compose up时,出现此错误:

Traceback (most recent call last): File "docker-compose", line 6, in File "compose/cli/main.py", line 71, in main File "compose/cli/main.py", line 127, in perform_command File "compose/cli/main.py", line 1085, in up File "compose/cli/main.py", line 1081, in up File "compose/project.py", line 527, in up File "compose/service.py", line 360, in ensure_image_exists File "compose/service.py", line 1084, in build File "site-packages/docker/api/build.py", line 159, in build File "site-packages/docker/utils/build.py", line 30, in tar File "site-packages/docker/utils/build.py", line 49, in exclude_paths File "site-packages/docker/utils/build.py", line 214, in rec_walk File "site-packages/docker/utils/build.py", line 184, in rec_walk PermissionError: [Errno 1] Operation not permitted: '/.Spotlight-V100' [6717] Failed to execute script docker-compose



这是我的 docker-compose.yml:
version: "3"

services:
about:
build: /
depends_on:
- "database"
ports:
- "3333:3333"

database:
image: mongo:latest

,这是我的Dockerfile:
FROM node:latest
RUN mkdir -p /src/app
WORKDIR /src/app
COPY . /src/app
RUN npm install
RUN npm run seed
EXPOSE 3333
CMD ["node", "server/index.js"]

创建图像并运行容器时, Dockerfile可以正确运行。我真的很想让 docker-compose工作。如有必要,将包含更多代码。

最佳答案

您的构建上下文引用了系统的根/,这就是为什么您获得权限被拒绝的原因。应该是相对的。尝试

version: "3"

services:
about:
build: ./
depends_on:
- "database"
ports:
- "3333:3333"

关于docker - 为什么在运行sudo docker-compose up时出现权限错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59434677/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com