DEV Community

Dongchao (Alan) Chen
Dongchao (Alan) Chen

Posted on

Upgrade old docker-compose in Ubuntu 18.04

Background

I am in an old system which installed Ubuntu 18.04, it has specifc security rules that does not allow user to talk to outside network, and I had issue using old version docker-compose which got installed by sudo apt install docker-compose. But I really need the latest docker-compose from github so that can support my latest docker-compose.yml definitions.

With Network Access

My favourite way when there is network access to github.com is always as described in this article.

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

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

docker-compose --version
Enter fullscreen mode Exit fullscreen mode

But how about no network?

No Network Access

Luckily that old Ubuntu 18.04 system, I can manage to upload docker-compose file I downloaded from other machine and then I did

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

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

docker-compose --version
Enter fullscreen mode Exit fullscreen mode

you thought it will work, right?

But you got this error message:

docker-compose: error while loading shared libraries: libz.so.1: failed to map segment from shared object
Enter fullscreen mode Exit fullscreen mode

Soluton is do the following command, see some explain here - "resolved by re-mounting the /tmp to give the volume permission to execute, it was accessible with read-only"

sudo mount /tmp -o remount,exec
Enter fullscreen mode Exit fullscreen mode

Now you will have the latest docker-compose on your old Ubuntu 18.04.

Top comments (0)