Reputation: 15766
I'm running my CI from within a docker container with docker installed. Inside that docker container, I'm running docker-compose with a postgres database. Even though the postgres database has fully started, I can't access it at localhost:8090
, like I should be able to.
I'm using the container syntax to run my github actions in a container. (tilt is running docker-compose for me) i.e.:
build-tilt:
name: Build Tilt
runs-on: [ self-hosted, docker ]
container:
image: devitllc/coretto-build:17
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Tilt CI
run: tilt ci --timeout 15m --debug
docker-compose.yml
:
version: "3.9"
services:
postgres:
image: postgres:14
ports:
- "8090:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: test
POSTGRES_DB: example
volumes:
- example-postgres:/var/lib/postgresql/data
deploy:
resources:
limits:
memory: 1g
healthcheck:
test: CMD pg_isready -U postgres
interval: 5s
timeout: 5s
retries: 10
I've tried accessing it at postgres
as well, and I'm unsure what I'm doing wrong. Perhaps I need to do something with networks? I don't have enough docker experience with networks to know what I should be doing.
I'm running multiple github actions runners from a single computer, so ideally nothing would be exposed outside of the container I'm using to run my container in.
EDIT: An example reproducing the failure, is here: https://github.com/ScottPierce/DockerInDockerNetworkingError
The CI logs are here: https://github.com/ScottPierce/DockerInDockerNetworkingError/actions Notice that it succeeds when it's not docker-in-docker.
Upvotes: 2
Views: 377