How to upgrade docker-compose to latest version

后端 未结 12 2210
遇见更好的自我
遇见更好的自我 2020-12-23 09:05

I have installed docker-compose using the command

sudo apt install docker-compose

It installed docker-compose version 1.8.0 and build unknown

相关标签:
12条回答
  • 2020-12-23 09:25

    If you installed with pip, to upgrade you can just use:

     pip install --upgrade docker-compose
    

    or as Mariyo states with pip3 explicitly:

     pip3 install --upgrade docker-compose
    
    0 讨论(0)
  • 2020-12-23 09:32

    If you have homebrew you can also install via brew

    $ brew install docker-compose
    

    This is a good way to install on a Mac OS system

    0 讨论(0)
  • 2020-12-23 09:35

    use this from command line: sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    Write down the latest release version

    Apply executable permissions to the binary:

    sudo chmod +x /usr/local/bin/docker-compose
    

    Then test version:

    $ docker-compose --version
    
    0 讨论(0)
  • 2020-12-23 09:36

    If you tried sudo apt-get remove docker-compose and get E: Unable to locate package docker-compose, try this method :

    This command must return a result, in order to check it is installed here :

    ls -l /usr/local/bin/docker-compose
    

    Remove the old version :

    sudo rm -rf docker-compose
    

    Download the last version (check official repo : docker/compose/releases) :

    sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    

    (replace 1.24.0 if needed)

    Finally, apply executable permissions to the binary:

    sudo chmod +x /usr/local/bin/docker-compose
    

    Check version :

    docker-compose -v
    
    0 讨论(0)
  • 2020-12-23 09:38

    First, remove the old version:

    If installed via apt-get

    sudo apt-get remove docker-compose
    

    If installed via curl

    sudo rm /usr/local/bin/docker-compose
    

    If installed via pip

    pip uninstall docker-compose
    

    Then find the newest version on the release page at GitHub or by curling the API if you have jq installed (thanks to dragon788 and frbl for this improvement):

    VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
    

    Finally, download to your favorite $PATH-accessible location and set permissions:

    DESTINATION=/usr/local/bin/docker-compose
    sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION
    sudo chmod 755 $DESTINATION
    
    0 讨论(0)
  • 2020-12-23 09:38

    I was trying to install docker-compose on "Ubuntu 16.04.5 LTS" but after installing it like this:

    sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    

    I was getting:

    -bash: /usr/local/bin/docker-compose: Permission denied

    and while I was using it with sudo I was getting:

    sudo: docker-compose: command not found

    So here's the steps that I took and solved my problem:

    sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    sudo ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose
    sudo chmod +x /usr/bin/docker-compose
    
    0 讨论(0)
提交回复
热议问题