gpt4 book ai didi

docker - 为什么此Docker构建失败?

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

以下是我的Dockerfile my-docker-file

FROM ubuntu:14.04
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y python python-pip git-all python-dev libxml2-dev libxslt1-dev libmysqlclient-dev gunicorn python-pycurl libcurl4-openssl-dev
RUN apt-get install -y rubygems-integration inotify-tools
RUN gem install sass -v 3.3.14
RUN apt-get install -y nodejs
RUN apt-get install -y npm
RUN npm install jsmin -g

但是它在最后一步中失败(请参见下文)。为什么会发生这种情况,我该如何解决?
$ docker build -f /path/to/my/project/my-docker-file .

<... FIRST EIGHT STEPS SNIPPED ...>

---> 742601020ac5
Step 9/9 : RUN npm install jsmin -g
---> Running in 6528f8aa90cc
npm http GET https://registry.npmjs.org/jsmin
npm http GET https://registry.npmjs.org/jsmin
npm http GET https://registry.npmjs.org/jsmin
npm ERR! Error: CERT_UNTRUSTED
npm ERR! at SecurePair.<anonymous> (tls.js:1370:32)
npm ERR! at SecurePair.EventEmitter.emit (events.js:92:17)
npm ERR! at SecurePair.maybeInitFinished (tls.js:982:10)
npm ERR! at CleartextStream.read [as _read] (tls.js:469:13)
npm ERR! at CleartextStream.Readable.read (_stream_readable.js:320:10)
npm ERR! at EncryptedStream.write [as _write] (tls.js:366:25)
npm ERR! at doWrite (_stream_writable.js:223:10)
npm ERR! at writeOrBuffer (_stream_writable.js:213:5)
npm ERR! at EncryptedStream.Writable.write (_stream_writable.js:180:11)
npm ERR! at write (_stream_readable.js:583:24)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>

npm ERR! System Linux 4.9.87-linuxkit-aufs
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "jsmin" "-g"
npm ERR! cwd /
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /npm-debug.log
npm ERR! not ok code 0
The command '/bin/sh -c npm install jsmin -g' returned a non-zero code: 1

最佳答案

这不是最好的解决方案,但这在这种情况下对我有用

FROM ubuntu:14.04
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y python python-pip git-all python-dev libxml2-dev libxslt1-dev libmysqlclient-dev gunicorn python-pycurl libcurl4-openssl-dev
RUN apt-get install -y rubygems-integration inotify-tools
RUN gem install sass -v 3.3.14
RUN apt-get install -y nodejs
RUN apt-get install -y npm
RUN npm config set strict-ssl false <-- Ignore the SSL cert
RUN npm install jsmin -g

更新:

更好的解决方案是使用npm注册表的http版本,如下所示
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y python python-pip git-all python-dev libxml2-dev libxslt1-dev libmysqlclient-dev gunicorn python-pycurl libcurl4-openssl-dev
RUN apt-get install -y rubygems-integration inotify-tools
RUN gem install sass -v 3.3.14
RUN apt-get install -y nodejs
RUN apt-get install -y npm
RUN npm config set registry http://registry.npmjs.org/
RUN npm install jsmin -g

关于docker - 为什么此Docker构建失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49744149/

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