0

Why is docker compose up cannot be executed under jenkins' workspace directory, saying no configuration file provided: not found:

# It doesn't work under the jenkins workspace
root@VM-0-7-ubuntu:/var/lib/jenkins/workspace/minimal-react-app# ls
dist  docker  docker-compose.yml
root@VM-0-7-ubuntu:/var/lib/jenkins/workspace/minimal-react-app# docker compose up -d
no configuration file provided: not found  # <----- why?
 
# However, it works under user's home directory
root@VM-0-7-ubuntu:/home/ubuntu/minimal-react-app# ls
dist  docker  docker-compose.yml
root@VM-0-7-ubuntu:/home/ubuntu/minimal-react-app# docker compose up -d
[+] Running 7/7
 ✔ nginx 6 layers [⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled    
# ...

They are the same files but inside different folders, but one works and the other don't, why is this?

Enfield Li
  • 1,952
  • 1
  • 8
  • 23

1 Answers1

0

Ok, I solved it by changing jenkins' workspace directory to another place, and finally managed to make it work. See How to change workspace and build record Root Directory on Jenkins?

This is the result:

# before: it was the default path:
/var/lib/jenkins/workspace

# after: 
/home/jenkins_home/jenkins/workspace
Enfield Li
  • 1,952
  • 1
  • 8
  • 23