0

I created a user defined bridge network like this:

docker network create my-net

Then I created two docker containers and and attached them to the same network:

docker create --name datalogger_container --network my-net --publish 9650:9650 datalogger:latest
docker create --name ui_container --network my-net --publish 5000:80 datalogger_ui:latest

The container ui_container is a flask application that tries to make rest calls to datalogger_container. However, the calls are not succeeding.

I am using the host name 'datalogger_container' in the ui_container but I see the error message

InvalidSchema: No connection adapters were found for 'datalogger_container:9650/load_details'

in the console output of the flask application. The port 9650 has been exposed. Can anyone help?

jignatius
  • 6,304
  • 2
  • 15
  • 30
  • It sounds to me like a typo or a syntax error. I don't know what kind of application you are creating but shouldn't the URL start with `http://`? Like this: `http://datalogger_container:9650/load_details` Or at least with another protocol. – Victor Calatramas Jul 05 '19 at 11:50
  • Get a shell in both containers and try to ping each other. If ping is successful then as Victor probably you might have a syntax/typo error. – leopal Jul 05 '19 at 13:00
  • That's the same error message as [Python Requests - No connection adapters](https://stackoverflow.com/questions/15115328/python-requests-no-connection-adapters), and that matches @VictorCalatramas suggestion. – David Maze Jul 05 '19 at 13:04
  • I added the 'http://' prefix and that did solve one issue. Thanks @VictorCalatramas. The other problem was a CORS issue when sending http requests to the datalogger_container. I tried changing the datalogger code so that it would put the Access-Control-Allow-Origin header in the response, but it made no difference. The request was being blocked by the container. The work around I implemented was to create Flask endpoints and the redirect the Angular JS calls there, from where the Python does the actual call and it succeeds.. – jignatius Jul 06 '19 at 21:37

0 Answers0