Docker container fails to access the internet — Solved
In my previous article, I explain what I get so far during my deep dive into Sitecore JSS — next. You will find this article here
Today, I was trying to spin up a JSS docker instance as explained here: “https://jss.sitecore.com/docs/nextjs/getting-started-nextjs/walkthrough-dotnetnew”. It went well. But when I was trying to execute the “docker-compose up” command, it has never been successful. I was always getting this screen:

It’s quite clear from this message that, it fails to connect to “nodejs.org” which clearly points to a “network issue”. I found a nice article about this to resolve here: “https://doc.sitecore.com/developers/100/developer-tools/en/troubleshooting-docker.html”. It helped a lot. I tried to follow that section which says: “Windows Container cannot access the internet” and did all the recommended approaches. I was quite frustrated.
Then I tried to open my available network connections. I tried to disable all of them except the primary one which is my case “wifi” but no luck
Then I was trying to execute this command to see the available network list one more time:
Get-NetIPInterface -AddressFamily IPv4 | Sort-Object -Property InterfaceMetric -Descending
I found the very last network (Ethernet 6 in my case) doesn’t have any “InterfaceMetric” therefore showing the most bottom. Then I tried to give this network a bigger “InterfaceMetric” by executing this:
Set-NetIPInterface -InterfaceAlias 'Ethernet 6' -InterfaceMetric 1000
I then also found a bridge network (vEthernet (nat)) that is disabled though. But I gave the minimum “InterfaceMetric” like below:
Set-NetIPInterface -InterfaceAlias 'vEthernet (nat)' -InterfaceMetric 1
Then I restart my docker by executing “net stop docker” and “net start docker”.
Holla, All fixed after that. I can successfully run “docker-compose” up -d then.
Cheers.