DEV Community

Dongchao (Alan) Chen
Dongchao (Alan) Chen

Posted on

1

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.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay