So I was trying to set up some websites and other stuff on my Ubuntu 20.04.3 LTS Server.
Different WebUI bases apps in different dockers accesed via a nginx. But I want able to connect to ANY of my dockers. After trubble shooting it seems that the port forwarding doesnt work on none of my dockers. It started with my node-red docker, nginx didnt work either and I now have setup a very simple whoami docker wis a very basic webserver running on port 8000.
I'm still not able to connect to it.
If I go into the docker using an "docker exec -ti whoami sh" I am able to access the webserver via wget but not from outside the docker.
I have searched a lot and most issues where false use of the -p flag or the webserver only listening to localhost and so on. Both is not the case here.
Here is my test terminal output to show whats happening
$~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
726da9705b7f jwilder/whoami "/app/http" About a minute ago Up About a minute 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp whoami
$~
$~ wget -O - http://127.0.0.1:8000/
--2021-10-16 23:19:09-- http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.
--2021-10-16 23:21:21-- (try: 2) http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... ^C
$~
$~ docker exec -ti whoami sh
/app # wget -O - http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000 (127.0.0.1:8000)
I'm 726da9705b7f
- 100% |*****************************************************| 17 0:00:00 ETA
/app # exit
$~
$~ cat run.sh
docker run -d -p 8000:8000 --name whoami -t jwilder/whoami
$~
$~
Proof that the server is not fixed to local host:
$~
$~ docker logs -f whoami
Listening on :8000
I'm 726da9705b7f
^C
$~
$~ docker exec -ti whoami sh
/app # ./http
Listening on :8000
2021/10/16 22:36:23 listen tcp :8000: bind: address already in use
/app # exit
$~
$~
And as far as I can tell the docker service actualy take the port:
$~
$~ sudo lsof -i:8000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 24976 root 4u IPv4 112329 0t0 TCP *:8000 (LISTEN)
docker-pr 24984 root 4u IPv6 114001 0t0 TCP *:8000 (LISTEN)
$~
$~
But its still not working.
Does anybody has an idea what is going wrong I am very clueless.