Reputation: 7693
I am new to Docker. I would like to run a docker-compose file. I have my docker-compose installed and please find below the details
which docker-compose
# returns usr/local/bin/docker-compose
docker-compose -v
# returns docker-compose version 1.24.0, build 0aa59064
I was referring the STACK OVERFLOW posts and was able to find something regarding the PATH variable, so I have also placed my docker-compose in /usr/bin/ path as well. So, the below command
find /usr/bin/ -name "docker-compose"
# returns /usr/bin/docker-compose
In addition, I made the files under both paths executable by using "chmod +x" command under respective folders.
So when I finally try to execute my docker-compose.yml file, I get the below error
sudo ./docker-compose up - I am executing this command right in the folder where docker-compose.yml file is present
And I get the below error,
sudo: ./docker-compose: command not found
How can I execute my docker-compose.yml file without any issues and start my containers. Am I making any mistakes while making it as an executable file?
Upvotes: 2
Views: 23634
Reputation: 448
Try sudo docker-compose
instead. The ./
means that the shell you're in will look in the current directory. If you aren't inside /usr/local/bin or /usr/bin, it will fail.
Also if you're on linux, you should follow the following instructions to avoid having to run docker as root: https://docs.docker.com/install/linux/linux-postinstall/
Upvotes: 3