I installed docker compose by following the usual guide of downloading using curl and giving execute permissions to that file. Issue I’m having is when I try to run docker compose I’m getting invalid command with some permission error. But when I run compose specifying the complete path of the compose file I.e. /usr/local/bin/docker-compose it works with out any issue. Any help will be appreciated.
Thanks
2
Answers
Not sure, how it worked. Adding the user to docker group solved the issue. By the way i was doing all of this in a VM through vagrant script.
A short term solution would be applying
sudo
in front of every docker-compose command.To fully install docker-compose, you’ll need to apply the following steps:
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
Apply executable permissions to the binary:
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
or, if you chose to install Compose for all users:
sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
Then verify you don’t need to use sudo anymore
docker compose version
You might also want to try
newgrp docker
The full installation can be found here (https://docs.docker.com/compose/install/compose-plugin/).