【发布时间】:2021-07-15 04:05:33
【问题描述】:
我今天刚开始使用 docker,但因权限问题而被阻止。我不知道我应该输入什么来切换权限。我假设这是一个chown的事情。还有其他关于堆栈溢出的问题,但它们对我没有帮助,因为它们不是 Docker 特定的,或者没有针对该问题的选定答案。
下面是错误
client_1 |
client_1 | > client@0.1.0 start
client_1 | > react-scripts start
client_1 |
client_1 | ℹ 「wds」: Project is running at http://172.19.0.2/
client_1 | ℹ 「wds」: webpack output is served from
client_1 | ℹ 「wds」: Content not from webpack is served from /app/public
client_1 | ℹ 「wds」: 404s will fallback to /
client_1 | Starting the development server...
client_1 |
client_1 | Failed to compile.
client_1 |
client_1 | EACCES: permission denied, mkdir '/app/node_modules/.cache'
我的 docker-compose.yml 看起来像这样:
version: "3"
services:
client:
stdin_open: true
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
volumes:
- "/app/node_modules"
- "./:/app"
我的 Dockerfile.dev 看起来像这样:
FROM node:alpine
RUN apk update && apk add git && apk add python make g++
WORKDIR /app
COPY package.json /app
# To Fix Permissions for Packages
RUN npm config set unsafe-perm true
RUN npm install --force
COPY . /app
CMD ["npm", "run", "start"]
【问题讨论】:
标签: linux docker permissions