Connect Postgres service with custom container image #25693
-
In my Django project, I have a CI workflow for running tests, which requires a Postgres service. Recently a new app introduced heavier packages such as pandas, matplotlib, pytorch and so on and this increased the Unfortunately, all goes well until it reaches the step to actually run the tests because it seems that the postgres service is not connected with the container and I get the following error:
This is my workflow right now. Any ideas on what I am doing wrong?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Your workflow is now running in a container of it’s own, next to the The job and service containers get attached to the same Docker network, so you should only need to change |
Beta Was this translation helpful? Give feedback.
-
airtower-luna:
@airtower-luna Thank you so much for your help. I spent too much time looking at the wrong places! |
Beta Was this translation helpful? Give feedback.
Your workflow is now running in a container of it’s own, next to the
postgres
container. So the port mapping to the runner VM doesn’t do anything any more (because it affects the host, not Docker containers on it).The job and service containers get attached to the same Docker network, so you should only need to change
POSTGRES_HOST
topostgres
(the name of the service container) and Docker’s DNS should do the rest.