如何解决有没有办法完全重置 docker-compose 服务? 因为我不能再使用 npm 了
我在 Docker 上使用 Symfony ApiPlatform 2.5,为 ReactJs 前端提供“客户端”服务。我真的不知道发生了什么,但是我不能用 npm 做更多事情,总是会出现这个错误:
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-04-04T09_55_47_791Z-debug.log
然后我尝试了“npm install --no-package-lock”,得到这个错误:
npm ERR! code EBUSY
npm ERR! syscall rmdir
npm ERR! path /usr/src/client/node_modules/.webpack-dev-server.DELETE/ssl
npm ERR! errno -16
npm ERR! EBUSY: resource busy or locked,rmdir '/usr/src/client/node_modules/.webpack-dev-server.DELETE/ssl'
当我尝试在容器上运行“rm -rf node_modules”时,我遇到了同样的错误:
rm: can't remove 'node_modules/.webpack-dev-server.DELETE/ssl': Resource busy
这里是 docker-compose 部分:
client:
build:
context: ./client
target: api_platform_client_development
cache_from:
- ${CLIENT_IMAGE:-quay.io/api-platform/client}
image: ${CLIENT_IMAGE:-quay.io/api-platform/client}
tty: true # https://github.com/facebook/create-react-app/issues/8688
environment:
- API_PLATFORM_CLIENT_GENERATOR_ENTRYPOINT=http://api
- API_PLATFORM_CLIENT_GENERATOR_OUTPUT=src
depends_on:
- dev-tls
volumes:
- ./client:/usr/src/client:rw,cached
- dev-certs:/usr/src/client/node_modules/webpack-dev-server/ssl:rw,nocopy
ports:
- target: 3000
published: 443
protocol: tcp
以及相关的 Dockerfile :
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
# https://docs.docker.com/compose/compose-file/#target
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG NODE_VERSION=13
ARG Nginx_VERSION=1.17
# "development" stage
FROM node:${NODE_VERSION}-alpine AS api_platform_client_development
workdir /usr/src/client
RUN yarn global add @api-platform/client-generator
RUN apk --no-cache --virtual build-dependencies add \
python \
make \
build-base
# prevent the reinstallation of node modules at every changes in the source code
copY package.json yarn.lock ./
RUN set -eux; \
yarn install
copY . ./
VOLUME /usr/src/client/node_modules
ENV HTTPS true
CMD ["yarn","start"]
# "build" stage
# depends on the "development" stage above
FROM api_platform_client_development AS api_platform_client_build
ARG REACT_APP_API_ENTRYPOINT
RUN set -eux; \
yarn build
# "Nginx" stage
# depends on the "build" stage above
FROM Nginx:${Nginx_VERSION}-alpine AS api_platform_client_Nginx
copY docker/Nginx/conf.d/default.conf /etc/Nginx/conf.d/default.conf
workdir /usr/src/client/build
copY --from=api_platform_client_build /usr/src/client/build ./
有没有办法完全重置(即:全新安装)这个服务,而不影响其他服务?我知道我们可以使用选项删除所有卷,但没有找到如何仅对一项服务采取行动。我有另一个服务的数据库,我不想丢失。 :/
谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。