Roberto Gonçalves
Roberto Gonçalves

Reputation: 3434

docker compose: Error while loading shared libraries: libz.so.1: failed to map segment from shared object: Operation not permitted

After installing docker and docker-compose on:

NAME="Red Hat Enterprise Linux Server"
VERSION="7.6 (Maipo)"

When executing:

sudo docker-compose -version

It returns:

Error while loading shared libraries: libz.so.1: failed to map segment from shared object: Operation not permitted

It should return:

docker-compose version 1.25.0-rc2, build 661ac20e

Installation from docker-compose is this

Upvotes: 63

Views: 103308

Answers (3)

Abdennour TOUMI
Abdennour TOUMI

Reputation: 93333

fixed in RHEL by setting export TMP=/var/tmp before running the cmd

Upvotes: 6

Kevin
Kevin

Reputation: 2736

Configuring a user specific TMPDIR directory solves the problem. The TMPDIR environment variable is POSIX standard, but TMP (and a few others) can be commonly accepted as well.

Other answers address how to configure the global, default temporary directory. Here are two examples if the system's security policy does not allow /tmp to be executable.

First Example Solution

mkdir $HOME/tmp
export TMPDIR=$HOME/tmp
docker-compose --version

For convenience, after the directory has been created, the "export" statement can be placed in the shell's profile configuration (example: ~/.bash_profile or ~/.bashrc).

Second Example Solution

Configure an alias (example files: ~/.bashrc or ~/.bash_alias).

alias docker-compose="TMPDIR=${HOME}/tmp docker-compose"

This is an issue that seems to be a common stumbling point. Some digging shows that it may be related to PyInstaller and not docker-compose specifically.

Upvotes: 65

Roberto Gonçalves
Roberto Gonçalves

Reputation: 3434

Got it solved by re-mounting the /tmp to give the volume permission to execute (it was accessible with read-only). So this solved:

sudo mount /tmp -o remount,exec

Upvotes: 161

Related Questions