Run docker-compose in RHEL

I was trying to run ‘docker-compose’ in our environment today, but found following message from RedHat officially:

Is docker-compose included in RHEL or RHEL Atomic Host ?

SOLUTION VERIFIED — Updated August 24 2017 at 11:12 AM -

English


Environment

  • Red Hat Enterprise Linux 7.x

Issue

  • We want to install docker-compose on a RHEL 7.4 server. Is it supported ? If not, are there any workarounds without using OpenShift ?
  • Is docker-compose included in RHEL or RHEL Atomic Host ?
  • Can docker-compose be added to the Extras channel - or be made available from Red Hat in general, like the other docker RPMs ?

Resolution

  • Red Hat recommends OpenShift (kube) and our container development kit, based on minishift, as the preferred technology for low-level container orchestration.
  • The ansible-container project is another project that provides strong overlap in capability with docker-compose and can also work with OpenShift.
  • Red Hat will continue to evaluate docker-compose and ansible-container but there are no plans to include either in RHEL at this time.

So we are on our own…

Get the latest version from Github: https://github.com/docker/compose/releases

Same as usual, link it to /usr/local/bin/docker-compose

Give it exe permission…

However, here is the problem happening in RHEL 7.4:

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

I tried to disable SElinux, not working…

Finally, I came across this github issue and I tried one of the workarounds which worked in my instance.

Solution was to remount tmp with exec permission by executing :

sudo mount /tmp -o remount,exec

Or have following ansible block:

- name: make mount tmp with exec
mount:
path: "/tmp"
state: mounted
src: /dev/mapper/rootvg-tmpvol # your own real path
fstype: xfs # your own real type
opts: nodev,nosuid # as long as you don't have noexec... :)

Problem resolved.

Happy docker-compose~

River

Like what you read? Give River Yang a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.