Upgrade docker-compose

I got stuck with one of the docker-compose.yml that was using v3.8 and my docker-compose version was old. It did not support v3.8 files only v3.3 and below was supported.

RaspberryPi at the time of writing only had docker-compose version 1.21 in apt repo and officially 1.29.1 was out.

Below is the list of commands I ran to remove old docker-compose and install new from python3/pip3.

  1.  Basic check
    user@hostname: $ pip3 --version
    pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
    user@hostname: $ python3 -V
    Python 3.7.3
  2. Remove already installed docker-compose
    $ sudo apt-get remove docker-compose
    
    # I had an older version
    user@hostname: $ pip3 list | grep docker-compose
    docker-compose 1.21.0
    
    $ pip3 uninstall docker-compose
    
  3. Install docker-compose via pip3
    user@hostname: $ pip3 install docker-compose==1.29.1
    
    #It failed for me with compilation error. It was missing ffi.h (fatal error: ffi.h: No such file or directory)
    user@hostname: $ sudo apt-get install libffi-dev
    
    #ran install again, It was a success this time
    user@hostname: $ pip3 install docker-compose==1.29.1
  4. Check python-compose install location
    # This is a really bad option. I did run this command for other alternatives, then I see that it does print the location of docker-compose :D
    user@hostname: $ pip3 uninstall docker-compose
    Uninstalling docker-compose-1.29.1:
    Would remove:
    /home /<user>/.local/bin/docker-compose
    
  5. Where to resolve docker-compose from?
    user@hostname: $ docker-compose
    -bash: /usr/bin/docker-compose: No such file or directory
    
    user@hostname: $ sudo ln -s /home /<user>/.local/bin/docker-compose /usr/bin/docker-compose
    


I am all set now!

user@hostname: $ docker-compose -version
docker-compose version 1.29.1, build unknown

 

HTH

 

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *