Running docker compose services with config files from Github Actions

I’m experiencing what I believe is a Docker-In-Docker issue. I have two repositories.

The first repository defines and configures a docker compose stack that should spin up a series of services. The repository in question can be found here - GitHub - david-engelmann/deploy-sourcegraph-docker: Sourcegraph with Docker Compose deployment reference. the main docker-compose.yaml file is docker-compose/docker-compose.yaml. It mounts a series of volumes and also has some for configuration files that need to be present and are in the repository in question ie. deploy-sourcegraph-docker/caddy/builtins/http.Caddyfile.

The second repository is going to be a tool that depends on the services defined in the first repository. So in the workflow, I’m looking to test utilizing the services declared in the first repository. I’ve included the link to the workflow yaml file below.


When trying to spin up the services declared in the first repository from the workflow file in the second repository, its looking for that file path on the original host and not relative to where the docker compose -f docker-compose/docker-compose.yaml up command was ran and isn’t finding anything. I’m not sure the best way to pass that file to the services I’m spinning up from my github action steps.

If anyone has had any luck with spinning up their docker compose stacks with config files / folders within Github Action steps and using them from other Github actions steps and could point me in the right direction, I’d be very appreciative. I’ll include a link to the last failed run, so you can see the error message about the file not existing / trying to mount a directory to a file


Here is the error message in question

Error response from daemon: failed to create shim task: OCI runtime create failed: 

runc create failed: unable to start container process: error during container init: error mounting "/__w/nvim_base/nvim_base/deploy-sourcegraph-docker/caddy/builtins/http.Caddyfile" to rootfs at "/etc/caddy/Caddyfile": 

mount /__w/nvim_base/nvim_base/deploy-sourcegraph-docker/caddy/builtins/http.Caddyfile:/etc/caddy/Caddyfile (via /proc/self/fd/6), 

flags: 0x5000: not a directory: 

unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

I added it as a discussion on Github community as well. Any help would be very appreciated!

You can set the working directory using the --project-directory parameter. If the parameter is not used, the location of the compose file in your command will be the working directory. If you use multiple compose files, the location of the first compose file will be used.

I understand that, It was passing the directory parameter without issue, the issue occurred when using docker-in-docker. the first docker container you launch the second docker container from isn’t the host and thus the files aren’t present when referencing the first docker container’s file path. I ended up needing a Dockerfile for the second docker container and having in the Dockerfile a step to copy over my configs