skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.

    curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    
    chmod +x /usr/local/bin/docker-compose
    
    //Added newly to resolve the permission issue.
    usermod -aG docker vagrant
    

  2. 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/).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search