docker-compose: error while loading shared libraries

When running docker-compose on CentOS 7, i get following error

[root@cp03 serverok-rubycms]# docker-compose up 
docker-compose: error while loading shared libraries: libz.so.1: failed to map segment from shared object: Operation not permitted
[root@cp03 serverok-rubycms]#

To fix the error, do the following

mv /usr/local/bin/docker-compose /usr/local/bin/docker-compose-bin

Now create a new file

vi /usr/local/bin/docker-compose

Add following content

#!/bin/bash

export TMPDIR=/opt/compose-tmp
/usr/local/bin/docker-compose-bin "$@"

Make it executable

chmod 755 /usr/local/bin/docker-compose

Create temp folder

mkdir -p /opt/compose-tmp

Now docker-compose will work.

Need help with Linux Server or WordPress? We can help!

One thought on “docker-compose: error while loading shared libraries

Leave a Reply

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