Which file is executed by GitLab Runner?

Hello,
I have a .gitlab-ci.yml in the root of the project. In this file, in the script section, I have written the docker compose up -d command. I have two questions:

1- Does GitLab Runner look for the docker-compose.yml file in the destination?

2- If I put the docker-compose.yml file in the root of the project, will GitLab Runner run this file?

Cheers.

GitLab runner mostly don’t care what you put in .gitlab-ci.yml, it’s passed to the executor (selected when you set up the runner) pretty much unchanged.

Neither GitLab nor the runner cares if what you do make sense, so no the runner does not look for docker-compose.yml.

GitLab runner won’t run a file called docker-compose.yml no matter what you do, but you don’t want it to anyway. I don’t know if you can coax the docker executor into caring about a docker-compose.yml, we have some projects using docker-in-docker and using docker-compose up as the single command (you can probably put more in, but as far as I have understood it will run in the outer docker, which is probably not what you want) in the script part of .gitlab-ci.yml. Those projects have a docker-compose.yml in the root of the project. Reading another question here I just realised that it might make sense to put that file in another directory and cd to that directory in a command in the script part of .gitlab-ci.yml (in a command preceeding docker-compose up).

1 Like