I’m facing a strange problem with my Docker setup. It works flawlessly when I run it locally, but when I try it in GitHub Actions, one of the containers becomes unreachable.
The error I see is:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=3000): Max retries exceeded with url: /rest/v1/users (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x8a2b19f4c920>: Failed to establish a new connection: [Errno 111] Connection refused'))
Here’s my docker-compose configuration for the troubled service:
workflow-engine:
image: registry.workflow.io/engine/main
ports:
- "3000:3000"
environment:
- WF_HOST=workflow-engine:3000
- WF_PORT=3000
- WF_PROTOCOL=http
- RUNTIME_ENV=production
- DATABASE_TYPE=postgres
- DB_PREFIX=wf_
- DB_POSTGRES_NAME=workflow_db
volumes:
- ./docker/engine/config:/app/.config
- ./docker/engine/storage:/storage
I am trying to connect to this service from my Python Flask application using the requests library. The odd thing is that the other services in the same compose file work perfectly in GitHub Actions.
To troubleshoot, I reduced it to these curl commands:
curl --fail http://localhost:8080 || exit 1
curl --fail http://localhost:3000/rest/v1/info/ || exit 1
The first command works (different service), but the second fails with curl: (7) Failed to connect to localhost port 3000 after 0 ms: Connection refused. I even tried changing the port number thinking GitHub Actions might already be using it.
Any suggestions on why this behavior is different between local and CI setups?