docker_images icon indicating copy to clipboard operation
docker_images copied to clipboard

Mount docker compose plugin into child container

Open marshall7m opened this issue 2 years ago • 1 comments

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

marshall7m avatar Aug 27 '22 22:08 marshall7m

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

catthehacker avatar Aug 29 '22 19:08 catthehacker