catthehacker / docker_images

Docker images
MIT License
206 stars 74 forks source link

Mount docker compose plugin into child container #70

Closed marshall7m closed 1 year ago

marshall7m commented 1 year ago

Background

I'm running integration tests within a docker container that is hosted by another container that is using the ghcr.io/catthehacker/ubuntu:act-latest image. In addition, this is all running within a GitHub actions job locally via act.

Goal

Within the child integration test container, I want to run docker compose commands that build necessary dependency containers for the tests. I'm able to mount the docker binary from the host /ubuntu:act-latest container although the docker compose plugin is not included which results in docker compose commands failing. I'm not sure if I'm missing any other volume that are needed in order for the docker compose plugin to work.

Here are relevant snippets from files:

tests.yml github action job:

integration:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Tests
      id: act_pytest_integration
      shell: bash
      run: |
        export DOCKERPATH=$(which docker)
        docker compose run --rm integration pytest tests/integration/tasks

docker-compose.yml withintegration service called from github action job:

integration:
    network_mode: host
    stdin_open: true
    tty: true
    image: terraform-aws-infrastructure-live/integration
    build: ./tests/integration
    volumes:
    - $PWD:/src
    - $DOCKERPATH:/usr/bin/docker:ro
    - /usr/libexec/docker/cli-plugins:/usr/libexec/docker/cli-plugins
    - /var/run/docker.sock:/var/run/docker.sock
    entrypoint: [/bin/bash, entrypoint.sh]
    profiles: [integration]

Thank you in advance

catthehacker commented 1 year ago

I have no idea since you didn't include any log