Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawn docker-compose ENOENT on Gitlab CI #213

Open
axeh opened this issue Sep 28, 2022 · 1 comment
Open

spawn docker-compose ENOENT on Gitlab CI #213

axeh opened this issue Sep 28, 2022 · 1 comment

Comments

@axeh
Copy link

axeh commented Sep 28, 2022

When I run tests(jest) for the application inside Gitlab CI this error is manifested:

spawn docker-compose ENOENT
at node_modules/testcontainers/dist/docker-compose/functions/docker-compose-up.js:37:15
at Generator.throw ()
at rejected (node_modules/testcontainers/dist/docker-compose/functions/docker-compose-up.js:6:65)

I have some docker-compose file and running it locally everything works OK.
Gitlab runner is configured like docker runner and can use docker-in-docker.
This is the setup of docker runner (https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker)

On Docker runner, we installed docker-compose so everything is working correctly.
If I run "docker-compose" command from GitLab CI everything works. But using the inside node app crashes the test execution.

GitLab CI looks something like

  image: docker:22.06-rc
  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: "/certs"
  services:
     - name: docker:22.06-rc-dind
  before_script:  
    - docker info
    - docker-compose --version
    - apk add --update npm
  script:
    - npm install
    - npm test

inside npm test it looks like

 const composeFilePath = path.resolve(__dirname, "../../somedirectory");
 const result = await upAll({ cwd: composeFilePath, log: true });
@sgavila
Copy link

sgavila commented Dec 20, 2022

I think that you are passing to cwd an invalid path and docker-compose can´t found the docker-compose.yaml file. Irecommend you try with absolute path in string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants