我正在尝试在Dockerfile中执行npm install,但即使在假定禁用颜色时,颜色代码似乎仍然出现在Dockerhub构建日志中.
我可能做错了什么?
您可以在Docker Hub上找到Dockerfile以及构建详细信息:https://hub.docker.com/r/amcsi/szeremi/builds/btk4utf3whezxqhnbzpkhyw/
Dockerfile:
FROM node
MAINTAINER Attila Szeremi
构建脚本输出的示例:
Step 3 : WORKDIR /src
---> Running in 4a8ec4902bee
---> ce66cec7780b
Removing intermediate container 4a8ec4902bee
Step 4 : RUN cd /src
---> Running in 561c6d10cdb8
---> c12b27e7c01a
Removing intermediate container 561c6d10cdb8
Step 5 : COPY package.json /src/package.json
---> ebbb940c8911
Removing intermediate container c39be008ad46
Step 6 : RUN npm set progress=false && npm set color=false && npm install --production
---> Running in c9ebee32f367
[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91mit worked if it ends with[0m[91m ok
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91musing[0m[91m npm@3.3.12
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91musing[0m[91m node@v5.5.0
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91mconfig[0m[91m set "progress" "false"
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m ok
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91mit worked if it ends with[0m[91m ok
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91musing[0m[91m npm@3.3.12
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91musing[0m[91m node@v5.5.0
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91mconfig[0m[91m set "color" "false"
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91mok[0m[91m
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91mit worked if it ends with[0m[91m ok
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91musing[0m[91m npm@3.3.12
[0m[91mnpm[0m[91m [0m[91minfo[0m[91m [0m[91musing[0m[91m node@v5.5.0
最佳答案
对我有用的解决方案是npm install 2>& 1,我在这里找到:https://github.com/nodejs/docker-node/issues/225