Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build and run your image in docker - network problem

I am on Ubuntu 16.04

I am completely new to docker and I am trying to follow this tutorial: https://docs.docker.com/get-started/part2/

When I arrive at giving the command: docker build --tag bulletinboard:1.0 .

I get stuck at:

Step 4/7 : RUN npm install
 ---> Running in c39c53244bbc

I tried also to put a --verbose after the npm install command and this is what I get in addition to getting stuck:

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 [email protected]
npm info using [email protected]
npm verb npm-session 6c1c828b01ec87d3
npm info lifecycle [email protected]~preinstall: [email protected]
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 ]

It seems to be a network issue (i.e. my docker container is not able to connect to the internet). I tried a lot of solutions from the internet but it seems that nothing worked for me. It is really frustrating because is the 2nd tutorial of the docker guide.

Could you please help me?

like image 961
desmond13 Avatar asked Nov 19 '25 09:11

desmond13


1 Answers

It's a simple firewalld issue.

run

sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0

and restart your firewalld,

sudo systemctl restart firewalld
like image 150
Sujith Manjavana Avatar answered Nov 20 '25 22:11

Sujith Manjavana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!