Running docker image for ASP.NET core sample from Microsoft on arch linux, cant browse to http://localhost:5000

36 views Asked by At

I installed arch linux (current version archlinux-2024.03.01-x86_64) on VM VirtualBox 7.0 (didn't use the archinstall script in case thats' relevant)

Install docker and git with

pacman -S docker
pacman -S git

And run the pacman -Sy and pacman -Su commands

Then followed the steps from this link https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-8.0

I cloned the docker dotnet app with

git clone https://github.com/dotnet/dotnet-docker

Built it as per instructions

docker build -t aspnetapp .

And got it to run (not sure why didn't run first try but eventually ran)

docker run -it --rm -p 5000:8080 --name aspnetcore_sample aspnetapp

This the output after executing the docker run command:

enter image description here

I can see from tty2 (other terminal) the container is running with docker ps command

enter image description here

However can't do a wget to the localhost:5000 or use lynx
enter image description here

What am I'm missing to set up to browser the url/webapp ?

note: I have network/internet in the arch virtual machine but haven't configured anything else

Update / Solved I executed the run command with a typo 5000:8000 instead of ... 5000:8080 (thanks Exploding Kitten for spotting the typo looks like my eyes aren't that sharp anymore)

Once I re-ran the command properly I can lynx to http://localhost:5000 url

enter image description here

Alternatively running from the repo also works as mentioned by jdchris100

docker run -it --rm -p 5000:8080 --name aspnetcore_sample mcr.microsoft.com/dotnet/samples:aspnetapp 

enter image description here

0

There are 0 answers