After installing Docker CE and Docker Compose on RHEL 7, I get an error trying to use it:

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

A quick Google of the error leads to a one-liner solution:

sudo mount /tmp -o remount,exec

The problem is, each time the system reboots that command has the be run again. I've considered making a Bash script run as root on bootup, but this seems hacky and hard to maintain.

Is there a way to mount /tmp with the configuration Docker Compose needs?

In case it's helpful, here is the output of mount and /etc/fstab:

$ mount | grep tmp
devtmpfs on /dev type devtmpfs (rw,nosuid,size=8119132k,nr_inodes=2029783,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,noexec)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
/dev/mapper/VolGroup00-LogVol02 on /tmp type ext3 (rw,nosuid,nodev,noexec,relatime,data=ordered)
/dev/mapper/VolGroup00-LogVol02 on /var/tmp type ext3 (rw,nosuid,nodev,noexec,relatime,data=ordered)
tmpfs on /run/user/16777223 type tmpfs (rw,nosuid,nodev,relatime,size=1626620k,mode=700,uid=16777223,gid=16777221)~

# /etc/fstab
# Created by anaconda on Fri Oct 13 01:03:21 2017
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
/dev/mapper/VolGroup00-LogVol00 /                       ext3    defaults        1 1
UUID=9e305d5c-10d9-431a-ab40-8fc3a7a7bf81 /boot                   ext3    defaults        1 2
/dev/mapper/VolGroup00-LogVol06 /home ext3 nodev 0 0
/dev/mapper/VolGroup00-LogVol02 /tmp ext3 nodev,nosuid,noexec 0 0
/dev/mapper/VolGroup00-LogVol03 /var                    ext3    defaults        1 2
/dev/mapper/VolGroup00-LogVol04 /var/log                ext3    defaults        1 2
/dev/mapper/VolGroup00-LogVol05 /var/log/audit          ext3    defaults        1 2
/dev/mapper/VolGroup00-LogVol01 swap                    swap    defaults        0 0
/dev/mapper/VolGroup01-LogVol01 /local/apps             xfs     defaults        1 2
tmpfs       /dev/shm        tmpfs   defaults,nodev,nosuid,noexec 0 0
/tmp /var/tmp none bind 0 0
  • Avoid putting answers in comments. – user1717828 Dec 4 '18 at 18:13

Your /etc/fstab is mounting the /tmp mount as noexec each time.

Replace that noexec option for the /tmp mount in /etc/fstab to be exec and reboot to see if that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.