Docker webserver cannot be reached

Hello,

I have Docker running on an externally hosted server.
I have Docker installed as standard.
Now I have created an nginx Docker with this command: docker run -d -p 8080:80 --name webserver nginx.

However, I do not get the default web interface of Nginx displayed.

Here is the version of Ubuntu

Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-75-generic x86_64)

and here the Docker version info:

root@ubuntu:~# docker version
Client: Docker Engine - Community
version: 24.0.2
API version: 1.43
Go version: go1.20.4
Git commit: cb74dfc
Built: Thu May 25 21:51:00 2023
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 24.0.2
API version: 1.43 (minimum version 1.12)
Go version: go1.20.4
Git commit: 659604f
Built: Thu May 25 21:51:00 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.21
GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc:
Version: 1.1.7
GitCommit: v1.1.7-0-g860f061
docker-init:
Version: 0.19.0
GitCommit: de40ad0

I can’t get it to call the services as localhost. From external via public IP it does not work either. I have now installed Nginx Local directly on the server. There everything works fine. I come immediately on the starting side of Nginx.

I’m really on the hose and just do not get on.

About help I would be really extremely happy!

Does “docker logs webserver2” give you anything

What do you mean by standard? A shared link could help us to see if you really followed the recommended way, but my guess is that will not be the problem.

How did you tried? On which port? Sometimes people just use the wrong port or a wrong ip address.

How do I look at the logs if it claims the currently running container doesn’t exist?

I’ve been struggling for a week to get any containers running and accessible via the browser including the “getting-started” project from the Documentation.

And now I can’t even look at the logs for a supposed running container because the daemon reports “No such container”

Hi, i belive you should have opened your own thread for this, but “getting-started” in your case is the image, not the container, to find your containers type: docker ps, or docker ps -a to also see the exited ones

Hi,

The “Webserver2” has a new name = “Webserver”.

root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
578d2299e204 nginx “/docker-entrypoint.…” 26 hours ago Up 26 hours 0.0.0.0:8080->80/tcp, :::8080->80/tcp webserver

Here are the Log files from the docker:

I used the Installation Guide from Docker themselves.

I tried with Lynx on Port 80 over Localhost (htt4p://localhost/)

Port 8080 link in the Picture in my first Post htt4p://localhost:8080/.

I wrote the “4” into the URL that i can write more links in this Post.
it is not a writing error.

I also tried over my Static public IP from the Server via Port 80 and 8080

I used Port 80 not with this Port configuration.
For this test i created a new docker like this:

docker run -d -p 80:80 --name webserver nginx

But nothing worked

This is the same thing I’m running into using the “getting-started” tutorial from the Docker Documentation. I haven’t had any luck running anything at all.

@terpz I didn’t open a new thread because it was in response to your logs comment and I’m having the same issue as the op.

Now that I have corrected my typo and looked at the logs for wizardly_franklin instead of wizardly-franklin. Here is what I’m getting:

2023-06-29 08:13:20 /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
2023-06-29 08:13:20 /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
2023-06-29 08:13:20 /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
2023-06-29 08:13:20 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
2023-06-29 08:13:20 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
2023-06-29 08:13:20 /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
2023-06-29 08:13:20 /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
2023-06-29 08:13:20 /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
2023-06-29 08:13:20 /docker-entrypoint.sh: Configuration complete; ready for start up
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: using the "epoll" event method
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: nginx/1.25.1
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4) 
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: OS: Linux 5.15.90.1-microsoft-standard-WSL2
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: start worker processes
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: start worker process 30
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: start worker process 31
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: start worker process 32
2023-06-29 08:13:20 2023/06/29 14:13:20 [notice] 1#1: start worker process 33

But as shown in my first screen shot I only get ERR_EMPTY_RESPONSE and can’t access the app. I don’t see any errors in the log but I guess I could be wrong.

Lynx should work, but have you also tried with curl or wget?

What happens if you try these commands?

From the host:

curl localhost:80

From the container

docker exec -it webserver curl localhost:80

You can share as many URLs as you want if you use code blocks which you should anyway :slight_smile:

@fatdollar You just forwarded port 3000 from the host to port 3000 in the container but the getting-started container listens on port 80 which is the default port of nginx not port 3000. @logixx forwarded the host port to the right container port. The port on the right side is always the container port.

docker run -dp 127.0.0.1:3000:80 getting-started

The above command should allow you to access the webpage from the browser on port 3000.

Offcource i tried curl over port 80

An 8080 but it run into nothing.

Today i installed docker local with the same steps and it worked instantly.

I wrote to the serverhost I hope they can give me an answer. Cause it just dont work on there server.

But an answer of this problem would be nice that I dont be dependent from the hoster

If that’s the case then the tutorial is incorrect. As per the screenshot of the tutorial I posted above.

I looked an I found this Docker Guid

In this Guide they give you this command:


docker run -d -p 80:80 docker/getting-started

So in this case its port 80

Please, share a link next time to the website you are using instead of a screenshot so we can find it faster. I found it and now I know I was wrong. The docker/getting-started image indeed contains an nginx that listens on port 80, but the image you created following the guide doesn’t use that. It runs nodejs and I tried it on my machine (MacBook running Docker Desktop for Mac) and port 3000 worked for me with the command that the guide mentions. I don’t have more time at the moment to investigate this issue, but is either something Windows specific or you made a mistake somewhere, but I wouldn’t be surprised by a Windows specific issue either.

I’m leaning towards it being a Windows issue to then. I just got back from a long holiday vacation so I’ll be trying to install this on my desktop server that is sort of my sand box to try things out. It is running Ubuntu so if the tutorial works I’ll just assume its windows related.

Thanks,

I found the error of my problem… The docker demon got no IP adress…

You looked with:

ip addr

Could be this the same error?

Actually it could be that would make sense. However it looks like my Docker does have an IP.

4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:61:a6:7e:1d brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:61ff:fea6:7e1d/64 scope link
       valid_lft forever preferred_lft forever

Docker is on a completely different subnet than the rest of my network. Do I have to add some kind of port forwarding? Or a bridge?

Also it says the the state for docker0 is DOWN. Probably another reason it’s not working…

OK I have figured out the issue on my end as well. I was not in the getting-started/app folder I was in the getting-started root folder and once I changed folders all was well.

1 Like

That docker0 is the bridge. The default bridge which is DOWN until a container uses it. The port forward already happened with using -p 3000:3000

Thanks. That’s how I assumed it was working. It was just user error on the build folder. Thanks for the help.