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

Local version app not reachable in docker container. #1589

Closed
JPBergsma opened this issue Apr 5, 2023 · 2 comments · Fixed by #1631
Closed

Local version app not reachable in docker container. #1589

JPBergsma opened this issue Apr 5, 2023 · 2 comments · Fixed by #1631

Comments

@JPBergsma
Copy link
Contributor

I tried to follow the instructions as described in https://www.optimade.org/optimade-python-tools/latest/deployment/container/
When I do :

docker run \
    --rm \
    --detach \
    --publish 8081:5000 \
    --env MAIN=main \
    --name my-optimade \
    --volume /path/to/optimade-python-tools:/app \
    ghcr.io/materials-consortia/optimade:latest

(and replace /path/to/optimade-python-tools with my local path for the optimade python tools.)

after wget http://localhost:8081/v1/structures
I get the error:

--2023-04-05 13:11:59--  (try: 5)  http://localhost:8081/v1/structures
Connecting to localhost (localhost)|127.0.0.1|:8081... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

Without specifying the volume parameter, it does work.(i.e. when it uses the version of the optimade python tools in the container.)

If I remove --detach I do get the normal start up output from the optimade-python-tools, so the app is loaded correctly.
It also restarts when I make changes to the local code. So it looks like it is indeed running the local code.
I am using the master branch.

@ml-evs
Copy link
Member

ml-evs commented May 10, 2023

I think I am also running into this on my latest docker builds, something wrong with the permissions of the run.sh file. Can investigate tonight.

@ml-evs
Copy link
Member

ml-evs commented May 12, 2023

Been trying to diagnose this today, I'm running into two issues:

  • when running from a local copy of the repo, the run.sh file that gets used is the one in the base of the repo, i.e., the dev server that uses uvicorn. We need to add something like --host 0.0.0.0 to this script so that it can be run successfully inside the container (it should then be visible at least)
  • when running in a slightly different way, I get an error about lack of permissions on the run.sh file which I assume is the "production" .docker/run.sh.

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.

2 participants