Docker Community Forums

Share and learn in the Docker community.

"hello-world-nginx" not giving quick preview of the example website

Running latest versions of docker and Kitemagic for Mac.
Have downloaded the “hello-world-nginx” image, but after starting it’s not showing the preview of the example website. How come ?

This is the installation log :

/website_files/index.html not found.
Copying default index.html…
nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log” failed (2: No such file or directory)
2020/04/17 09:26:30 [notice] 8#0: using the “epoll” event method
2020/04/17 09:26:30 [notice] 8#0: nginx/1.4.7
2020/04/17 09:26:30 [notice] 8#0: built by gcc 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r45973)
2020/04/17 09:26:30 [notice] 8#0: OS: Linux 4.19.76-linuxkit
2020/04/17 09:26:30 [notice] 8#0: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2020/04/17 09:26:30 [notice] 8#0: start worker processes
2020/04/17 09:26:30 [notice] 8#0: start worker process 9

Did you expose the port with -p 80:80?

how do I do that ? I thought everything was fully automated…

Thats not how docker works. It’s kinda fully automated but for security reasons you have to specify some options yourself.

Basically you need to map a port on your host system to a port in the container (the port nginx runs on).
An example looks like this:
docker run -p 8000:80 hello-world-nginx`
This will start a container bases on the image hello-world-nginx and maps your port 8000 to the containers port 80. You can choose whatever port you want instead of 8000 but you have to stick to the port 80 from nginx.

ok, thanks for putting up with my docker illiteracy… I’m really new to all this.
Ok, so pasting your command in my terminal.app returns the following :

docker run -p 8000:80 hello-world-nginx
Unable to find image ‘hello-world-nginx:latest’ locally
docker: Error response from daemon: pull access denied for hello-world-nginx, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied.
See ‘docker run --help’.

What did I manage to do wrong here?

This was more like an example. I think (not sure tho. You need to know which image you want) the image you want is kitematic/hello-world-nginx

ok I put a space before the kitemagic part upfront, hope that’s what I had to do.
At least getting a different error msg now :slight_smile:

docker run -p 8000:80 kitematic/hello-world-nginx

/website_files/index.html not found.

Copying default index.html…

nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log” failed (2: No such file or directory)
2020/04/17 11:35:21 [notice] 8#0: using the “epoll” event method
2020/04/17 11:35:21 [notice] 8#0: nginx/1.4.7
2020/04/17 11:35:21 [notice] 8#0: built by gcc 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r45973)
2020/04/17 11:35:21 [notice] 8#0: OS: Linux 4.19.76-linuxkit
2020/04/17 11:35:21 [notice] 8#0: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2020/04/17 11:35:21 [notice] 8#0: start worker processes
2020/04/17 11:35:21 [notice] 8#0: start worker process 9

So problematic part seems first line :
nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log” failed (2: No such file or directory)
did I have to somehow create that unexisting folder manually?

Do you follow a tutorial or something like that? Sadly the docker hub page of that images doesn’t say how to set it up.

no I don’t. I thought it was sufficient to simply install the docker image, especially as it was stated as the most basic exemple on their webpage here :
https://docs.docker.com/kitematic/nginx-web-server/
couldn’t/shouldn’t have gotten easier than that…
Apparently that’s not the case…
Is it an issue that I’m behind a corporate firewall and that certain ports/protocols ought to be available?

Okay, I kinda guessed that website :smiley:
Do note the following:

Legacy desktop solution. Kitematic is a legacy solution, bundled with Docker Toolbox. We recommend updating to Docker Desktop for Mac or Docker Desktop for Windows if your system meets the requirements for one of those applications.

Why don’t you use Docker Desktop for Mac?

The image kitematic/hello-world-nginx got its last update 5 years ago so its most likely outdated. This might be the reason why this doesn’t work.

As long as you managed to pull the image or start a container there should be no problem. If the container on the other hand needs internet access, you have to tell him about the proxy.

If you just want a running webserver I suggest you take a look at the official nginx image.
https://hub.docker.com/_/nginx
It’s well documented and explains almost everything.

Quickstart: docker run --rm -it -p 80:80 nginx

Then visit http://localhost:80 and you will see the nginx welcome page.

Why don’t you use Docker Desktop for Mac?
The image kitematic/hello-world-nginx got its last update 5 years ago so its most likely outdated. This might be the reason why this doesn’t work.

Actually I do. I thought kitematic was just a minimal GUI frontend for the Docker desktop app, such as Dockstation, in order to make things a bit more manageable for non-*NIX geeks like me, but apparently it’s more than than.
I’ll try out your suggestions and post back… thanks

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

amazing ! Feeling expert already (lol). Do get a little error msg :

/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory)

Nice.
This is not a docker problem anymore but nginx telling you that it doesn’t find a favicon. Configure nginx accordingly and the warning will go away.

ok thanks, at least it’s a working start. Thanks for the help.

1 Like

Agreed. The tutorials available online can be really handy in such situations.