gpt4 book ai didi

Windows 上的 Dockerfile 复制超时问题

转载 作者:行者123 更新时间:2023-12-02 07:04:48 25 4
gpt4 key购买 nike

我在 Windows 上运行 docker build 时遇到问题,

Dockerfile:

FROM node:alpine AS builder

WORKDIR /app

COPY . .

RUN npm cache clean --force
RUN npm install > npm.log 2>&1
RUN npm run build

FROM nginx:alpine

COPY --from=builder /app/dist/* /usr/share/nginx/html

命令:

docker build --no-cache --rm -t fe-app:latest .

问题:

Step 8/8 : COPY --from=builder /app/dist/* /usr/share/nginx/html
COPY failed: opengcs: copyWithTimeout: timed out (RunProcess: copy back from remotefs lstat /tmp/666137919f5d3c5661175c59a8f4f9051ed09611a5b560e7045828ec1f9c1ec7-mount/app/dist/uncommon/assets/data-test/service-staff-data/services-staff-ui-action.json)

完整控制台输出:

Sending build context to Docker daemon  4.471MB
Step 1/8 : FROM node:alpine AS builder
alpine: Pulling from library/node
bdf0201b3a05: Pull complete
26f0dbb4f100: Pull complete
9af56c7c17da: Pull complete
Digest: sha256:ca1695f514d5dc54b4812f8b9029b277f86b50e83870af47bfa4582af0ec695d
Status: Downloaded newer image for node:alpine
---> 1bdfa12c22dc
Step 2/8 : WORKDIR /app
---> Running in 75a2de3672da
Removing intermediate container 75a2de3672da
---> 53a7b85e7278
Step 3/8 : COPY . .
---> a6fbf046933b
Step 4/8 : RUN npm cache clean --force
---> Running in 16148fc51784
npm WARN using --force I sure hope you know what you are doing.
Removing intermediate container 16148fc51784
---> 1f0b1dbf0a36
Step 5/8 : RUN npm install > npm.log 2>&1
---> Running in 8ac705a53089
Removing intermediate container 8ac705a53089
---> 6ae70108adb1
Step 6/8 : RUN npm run build
---> Running in ba84c78a50bb

> uncommon@0.0.0 build /app
> ng build


Date: 2019-04-18T13:22:02.537Z
Hash: 3d032830d7fde6941cf7
Time: 66267ms
chunk {main} main.js, main.js.map (main) 270 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 237 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 23.9 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.14 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.69 MB [initial] [rendered]
Removing intermediate container ba84c78a50bb
---> 487cf0c02a50
Step 7/8 : FROM nginx:alpine
alpine: Pulling from library/nginx
bdf0201b3a05: Already exists
08d74e155349: Pull complete
a9e2a0b35060: Pull complete
d9e2304ab8d0: Pull complete
Digest: sha256:61e3db30b1334b1fa0a2e71b86625188f76653565d515d5f74ecc55a8fb91ce9
Status: Downloaded newer image for nginx:alpine
---> 0be75340bd9b
Step 8/8 : COPY --from=builder /app/dist/* /usr/share/nginx/html
COPY failed: opengcs: copyWithTimeout: timed out (RunProcess: copy back from remotefs lstat /tmp/666137919f5d3c5661175c59a8f4f9051ed09611a5b560e7045828ec1f9c1ec7-mount/app/dist/uncommon/assets/data-test/service-staff-data/services-staff-ui-action.json)

我在本地环境上运行相同的内容并成功运行,但我在服务器上遇到问题,当我在服务器上运行它时,它会在我的本地环境上生成文件夹 c:\tmp\666137919f5d3c5661175c59a8f4f9051ed09611a5b560e7045828ec1f9c1ec7-mount t。

希望有人给我提示,先谢谢了。

最佳答案

这不是如何解决问题的解决方案,而是如何避免问题的解决方案:

首先压缩文件夹,然后仅复制 zip 文件。

Dockerfile:

FROM node:alpine AS builder

RUN apk add zip

WORKDIR /app

COPY . .

RUN npm cache clean --force
RUN npm install > npm.log 2>&1
RUN npm run build

RUN zip -r npm.zip /app/dist

FROM nginx:alpine

WORKDIR /usr/share/nginx/html

RUN apk add unzip

COPY --from=builder /app/npm.zip /usr/share/nginx/html/

RUN unzip npm.zip

关于Windows 上的 Dockerfile 复制超时问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55747845/

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