我在Ubuntu 16.04上
我对docker完全陌生,我正在尝试遵循本教程: https://docs.docker.com/get-started/part2/
当我给出命令时:
docker build --tag bulletinboard:1.0 .
我被困在:
Step 4/7 : RUN npm install
---> Running in c39c53244bbc
我还尝试在--verbose
命令后放置npm install
,这除了卡住之外,我还能得到以下结果:
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install', '--verbose' ]
npm info using npm@6.14.4
npm info using node@v12.16.2
npm verb npm-session 6c1c828b01ec87d3
npm info lifecycle vue-event-bulletin@1.0.0~preinstall: vue-event-bulletin@1.0.0
npm timing stage:loadCurrentTree Completed in 19ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 3ms
npm timing stage:rollbackFailedOptional Completed in 1ms
npm timing stage:runTopLevelLifecycles Completed in 320451ms
npm verb type request-timeout
npm verb stack FetchError: network timeout at: https://registry.npmjs.org/bootstrap
npm verb stack at Timeout._onTimeout (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:61:18)
npm verb stack at listOnTimeout (internal/timers.js:549:17)
npm verb stack at processTimers (internal/timers.js:492:7)
npm verb cwd /usr/src/app
npm verb Linux 4.15.0-96-generic
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--verbose"
npm verb node v12.16.2
npm verb npm v6.14.4
npm ERR! network timeout at: https://registry.npmjs.org/bootstrap
npm verb exit [ 1, true ]
这似乎是网络问题(即我的Docker容器无法连接到互联网)。我尝试了很多来自Internet的解决方案,但似乎没有任何效果对我有用。确实令人沮丧,因为这是Docker指南的第二篇教程。
能帮我吗?
答案 0 :(得分:2)
这是一个简单的防火墙问题。
运行
sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0
然后重新启动防火墙,
sudo systemctl restart firewalld