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.

Comments

One response to “docker-compose: error while loading shared libraries”

  1. ap Avatar
    ap

    > after
    mkdir -p/opt/compose-tmp
    > need to make the directory writable
    sudo chmod 777 /opt/compose-tmp

Leave a Reply

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