Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue running app in docker #4

Open
AgostinhoX opened this issue Sep 25, 2020 · 4 comments
Open

Issue running app in docker #4

AgostinhoX opened this issue Sep 25, 2020 · 4 comments

Comments

@AgostinhoX
Copy link

when I create a container based in the docker image freecad:1.0 create using your Dockerfile:
"docker run freecad:1.0", the following appears:

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

@mmiscool
Copy link
Owner

mmiscool commented Oct 20, 2020

It seems like you already have an http server running on port 80.
Kill your nginx service and try again.
Also are you running the build script?
./build-run.sh

@Llibyddap
Copy link

Great project... I've learned a lot...

I also get this port 80 failure. I've done the build from my local machine, I've pulled it into my k3s for a build there and I've also pulled the image and used it from DockerHub. All three see to have the same issue - all on different systems (and at least on the K3s - I'm very certain of port conflicts).

I think the conflict is with Droopy:

def run(hostname='',
        port=80,
        templates=None,
        localisations=None,

This also causes the fileserver to not run. When I switch over to the File Manager tab it throws a 502 Bad Gateway
(nginx/1.14.0 (Ubuntu)) error. I'll circle back this weekend when I have more time and see if i can force some different ports and get a different answer...

If I'm completely lost - let me know... Thanks.

@Llibyddap
Copy link

Llibyddap commented Apr 27, 2021

I think there are two issues here - the OP issue I was able to solve. After some research (and my lack of experience with supervisord) it looks like docker requires processes to run in the foreground.

supervisord seems to launch nginx as expected. Then when nginx is pushed to the background (daemon mode), supervisord thinks it's missing and restarts the service. Because the service is running in the background, nginx throws an error when a second instance of nginx is launched. I spent a bunch of time trying to 'fix' nginx config files. The issue is actual how supervisord manages services.

The solution was therefore pretty straight forward. When executing nginx the command needs to be nginx -g "daemon off;". After making this change to the supervisord.conf file the nginx service runs as expected.

#supervisord.conf

[program:nginx]
command=nginx -g "daemon off;"
autorestart=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

I'll post a seperate thread if I figure out my other issue on the Droopy 502 Bad Gateway problem.

@mmiscool
Copy link
Owner

Can you try and set up docker on a fresh clean Ubuntu virtual machine. It sounds like you have a port conflict with some thing else running on your server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants