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

Docker container does not expose UI on port 5000 #464

Closed
ERafaelMartinez opened this issue Jul 20, 2022 · 7 comments · Fixed by #465
Closed

Docker container does not expose UI on port 5000 #464

ERafaelMartinez opened this issue Jul 20, 2022 · 7 comments · Fixed by #465

Comments

@ERafaelMartinez
Copy link

Hi FlexMeasures team,

Today I experienced an issue following the toy example on readthedocs. I can follow the tutorial up to the point where I try to see the UI on localhost:5000, unsuccessfully. I followed the docker approach on macOS. All of the terminal outputs seem to be working correctly.

I'm not sure what is wrong. Could you help me out, please? Thanks in advance!

@joyshmitz
Copy link
Contributor

Hi @ERafaelMartinez send the output of the docker ps command

@ERafaelMartinez
Copy link
Author

ERafaelMartinez commented Jul 20, 2022

@joyshmitz docker ps output
image

@ERafaelMartinez
Copy link
Author

And the container's logs
image

@joyshmitz
Copy link
Contributor

joyshmitz commented Jul 20, 2022

everything works, you can check who occupies port 5000 with the command 'lsof -i :5000'

it should look something like this
'
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
gunicorn 469933 root 5u IPv4 2573535 0t0 TCP *:5000 (LISTEN)
gunicorn 1104824 root 5u IPv4 2573535 0t0 TCP *:5000 (LISTEN)
gunicorn 1105307 root 5u IPv4 2573535 0t0 TCP *:5000 (LISTEN)'

@nhoening
Copy link
Contributor

Thanks for the report!

In the tutorial, we're not using docker-compose as I don't want to add that dependency. The connection between the hosts was supposed to work with `--net=host. It worked on Linux when I created it.

Now I did some research suggesting that this option is not supported on MacOS. For instance, here.

Furthermore, I could reproduce your issue on my computer. The port 5000 is not available. Maybe this is because I switched to Docker Desktop in the meantime.

Here is an idea for improving the tutorial:

docker network create flexmeasures_network
docker run --rm --name flexmeasures-tutorial-db -e POSTGRES_PASSWORD=fm-db-passwd -e POSTGRES_DB=flexmeasures-db -d --network=flexmeasures_network postgres:latest 
docker run --rm --name flexmeasures-tutorial-fm --env SQLALCHEMY_DATABASE_URI=postgresql://postgres:fm-db-passwd@flexmeasures-tutorial-db:5432/flexmeasures-db --env SECRET_KEY=notsecret --env FLASK_ENV=development --env LOGGING_LEVEL=INFO -d --network=flexmeasures_network -p 5000:5000 lfenergy/flexmeasures

@ERafaelMartinez could you check if these three lines work better when they replace the two existing docker run lines?

In the meantime, the tutorial can also be run in docker-compose, see here.

@ERafaelMartinez
Copy link
Author

@nhoening It works well now! Thanks

@joyshmitz I guess we have different docker versions. I should have posted mine probably. Docker version 20.10.16, build aa7e414, and I'm also using Docker Desktop currently.

@joyshmitz
Copy link
Contributor

 @ERafaelMartinez I'm glad the problem is solved

@nhoening nhoening linked a pull request Jul 21, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants