FC-Docker
FC-Docker copied to clipboard
Issue running app in docker
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)
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
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.
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.
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.