How to install docker-compose on Fedora CoreOS

Andriy F. asked:

I have been using Fedora CoreOS version 31.20200505.3.0 on digitalocean (image took from here https://getfedora.org/coreos/download?tab=cloud_operators&stream=stable)

Default user core, but need elevation to use docker

Installing docker-compose via binary with command

curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o ~/bin/docker-compose
chmod +x ~/bin/docker-compose

doesn’t work due to error: “[6261] Error loading Python lib ‘/tmp/_MEI7CUfMy/libpython3.7m.so.1.0’: dlopen: libcrypt.so.1: cannot open shared object file: No such file or directory

So I tried alternative install via

curl -L --fail https://github.com/docker/compose/releases/download/1.25.5/run.sh -o ~/bin/docker-compose
chmod +x ~/bin/docker-compose

(as root)
But then was the problem with inaccessible bind mounts. Solved with solution from here https://stackoverflow.com/questions/24288616/permission-denied-on-accessing-host-directory-in-docker (added :Z) to option and modified ~/bin/docker-compose shell script accordingly.

But then I’m getting error “Couldn’t connect to Docker daemon at http+docker://localhost – is it running?”

If running docker-compose sh and docker run hello-world I get “docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See ‘docker run –help’.”

At this point I’m considering other container distribution or debian.

Can anyone point out how to install docker-compose on Fedora CoreOS?

UPD:
Thanks to @Bert hint this solves issue with docker-compose binary sudo rpm-ostree install libxcrypt-compat

My answer:


Why don’t you just install the docker-compose package directly? As the Fedora package maintainer for docker-compose I try to make sure this works for all Fedora users.

[[email protected] ~]$ sudo rpm-ostree install docker-compose
Checking out tree 318de83... done
Enabled rpm-md repositories: fedora-cisco-openh264 updates fedora updates-archive
rpm-md repo 'fedora-cisco-openh264' (cached); generated: 2020-08-25T19:05:18Z
rpm-md repo 'updates' (cached); generated: 2020-12-13T02:23:33Z
rpm-md repo 'fedora' (cached); generated: 2020-04-22T22:22:36Z
rpm-md repo 'updates-archive' (cached); generated: 2020-12-13T04:16:16Z
Importing rpm-md... done
Resolving dependencies... done
Will download: 40 packages (15.8 MB)
Downloading from 'updates'... done
Downloading from 'fedora'... done
Importing packages... done
Checking out packages... done
Running pre scripts... done
Running post scripts... done
Running posttrans scripts... done
Writing rpmdb... done
Writing OSTree commit... done
Staging deployment... done
Added:
  docker-compose-1.25.4-1.fc32.noarch
  gdbm-libs-1:1.18.1-3.fc32.x86_64
  libsodium-1.0.18-3.fc32.x86_64
  libxcrypt-compat-4.4.17-1.fc32.x86_64
  python-pip-wheel-19.3.1-4.fc32.noarch
  python-setuptools-wheel-41.6.0-2.fc32.noarch
  python-unversioned-command-3.8.6-1.fc32.noarch
  python3-3.8.6-1.fc32.x86_64
  python3-attrs-19.3.0-2.fc32.noarch
  python3-bcrypt-3.1.7-4.fc32.x86_64
  python3-cached_property-1.5.1-7.fc32.noarch
  python3-cffi-1.14.0-1.fc32.x86_64
  python3-chardet-3.0.4-15.fc32.noarch
  python3-cryptography-2.8-3.fc32.x86_64
  python3-docker-4.2.0-1.fc32.noarch
  python3-docker-pycreds-0.4.0-6.fc32.noarch
  python3-dockerpty-0.4.1-18.fc32.noarch
  python3-docopt-0.6.2-16.fc32.noarch
  python3-fluidity-sm-0.2.0-18.fc32.noarch
  python3-idna-2.8-6.fc32.noarch
  python3-invoke-1.4.1-1.fc32.noarch
  python3-jsonschema-3.2.0-2.fc32.noarch
  python3-lexicon-1.0.0-10.fc32.noarch
  python3-libs-3.8.6-1.fc32.x86_64
  python3-paramiko-2.7.1-2.fc32.noarch
  python3-pip-19.3.1-4.fc32.noarch
  python3-ply-3.11-7.fc32.noarch
  python3-pyOpenSSL-19.0.0-6.fc32.noarch
  python3-pyasn1-0.4.8-1.fc32.noarch
  python3-pycparser-2.19-2.fc32.noarch
  python3-pynacl-1.3.0-6.fc32.x86_64
  python3-pyrsistent-0.16.0-1.fc32.x86_64
  python3-pysocks-1.7.1-4.fc32.noarch
  python3-pyyaml-5.3.1-1.fc32.x86_64
  python3-requests-2.22.0-8.fc32.noarch
  python3-setuptools-41.6.0-2.fc32.noarch
  python3-six-1.14.0-2.fc32.noarch
  python3-texttable-1.6.2-5.fc32.noarch
  python3-urllib3-1.25.7-3.fc32.noarch
  python3-websocket-client-0.56.0-6.fc32.noarch
Run "systemctl reboot" to start a reboot

Remember that in order to use Docker (without sudo) your user must be in the docker group. By default the CoreOS core user is not in this group.

[[email protected] ~]$ sudo usermod -aG docker core

After you log out and log back in, confirm your user is in the docker group.

[[email protected] ~]$ id
uid=1000(core) gid=1000(core) groups=1000(core),4(adm),10(wheel),16(sudo),190(systemd-journal),978(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Now you can use docker-compose.

[[email protected] ~]$ cd composetest/
[[email protected] composetest]$ docker-compose up
Creating network "composetest_default" with the default driver
Building web
Step 1/10 : FROM python:3.7-alpine

...

web_1    |  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.