You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to connect to Postgres db from within my Docker image to run tests:
test_backend:
runs-on:
group: ubuntu-largeneeds: build_backend# Service containers to run with `container-job`services:
# Label used to access the service containerpostgres:
# Docker Hub imageimage: postgres# Provide the password for postgresenv:
POSTGRES_PASSWORD: postgres# Set health checks to wait until postgres has startedoptions: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432steps:
- name: Run tests in containeruses: addnab/docker-run-action@v3with:
image: backend-py:${{github.sha}}run: ./manage.py test --noinputoptions: --env-file .github/workflows/env.test
There is a script, that tries to connect to Postgres running as a service. However I can't figure out, how to set the correct network/host value. I've tried to set in env.test:
If you haven't figured it out, or for others who come across this, the hostname here would just be postgres, no other fancy docker networking necessary.
I'm trying to connect to Postgres db from within my Docker image to run tests:
There is a script, that tries to connect to Postgres running as a service. However I can't figure out, how to set the correct network/host value. I've tried to set in
env.test
:Which gives me error:
django.db.utils.OperationalError: could not translate host name "${input_docker_network}" to address: Name or service not known
How should I specify the host name to successfully connect to Postgres GitHub service?
The text was updated successfully, but these errors were encountered: