New Package Request: docker compose
Package name and purpose Either include docker compose in flatcar, or provide documentation on how to easily enable it through ignition.
- Package upstream repo: https://github.com/docker/compose
- Gentoo ebuild: https://github.com/gentoo/gentoo/blob/master/app-containers/docker-compose/docker-compose-2.11.2.ebuild
Impact of adding this package to the Flatcar OS image
The package improves on the following core values:
- [ ] Secure by default
- [ ] Always up to date
- [x] Improve container experience
- [x] Operate at scale / automation / telemetry
The package will increase the image size by: needs to be evaluated.
How might this package increase the attack surface:
- cli utility
Benefits of adding this package docker compose (or docker-compose) is a simple container orchestration system.
Additional information [ Please add any information that does not fit into any of the above sections here ]
I agree, this would be great to have docker-compose built-in. It's literally the only thing I add to the OS.
Note that I install it after the system is online, you just have to use the writable /opt/bin location. Be sure to run as root (sudo has issues)
sudo -i
curl -SL https://github.com/docker/compose/releases/download/v2.11.2/docker-compose-linux-x86_64 -o /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
I would really like to have this in the base. :)
For the record, here's a Butane configuration to download docker-compose and run a simple application:
---
variant: flatcar
version: 1.0.0
storage:
files:
- path: /opt/bin/docker-compose
contents:
source: https://github.com/docker/compose/releases/download/v2.11.2/docker-compose-linux-x86_64
verification:
hash: sha512-8ad55ea1234e206ecad3e8ecf30f93de5cc764a423bf8ff179b25320f148e475b569ab9ec68d90eacfe97269528ff8fef1746c05381c7d05edc85d2f2c245e69
mode: 0755
- path: /home/core/docker-compose.yml
contents:
inline: |
services:
web:
image: nginx
ports:
- 80:80
mode: 0644
user:
name: core
group:
name: core
systemd:
units:
- name: application.service
enabled: true
contents: |
[Unit]
Description=Minimalist docker-compose example
[Service]
ExecStart=/opt/bin/docker-compose -f /home/core/docker-compose.yml up
[Install]
WantedBy=multi-user.target
To generate Ignition:
podman run --rm -i quay.io/coreos/butane:latest < config.yaml > config.json
Thanks I will update my butane files...
As an alternative, you can try utilizing the docker-compose from the official docker image:
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/app -w /app docker:latest docker-compose
Maybe we can add that as an alias?
Has anyone managed to install the cli-plugin systemwide?
Maybe this should go into another sysext? Or maybe into the docker one since things changed since this was opened?
Has anyone managed to install the cli-plugin systemwide?
What about this: https://docs.docker.com/compose/install/linux/#install-the-plugin-manually ? This can be easily done via provisioning with Ignition. I just gave a try and it works fine:
$ docker compose version
Docker Compose version v2.30.3
For what is worth, there is a community supported docker-compose sysext too: https://github.com/flatcar/sysext-bakery/releases/tag/latest
@tormath1 sorry to hijack, can you share a little more on the greater vision and day to day: https://github.com/flatcar/Flatcar/discussions/1595
@tormath1 sorry to hijack, can you share a little more on the greater vision and day to day: #1595
No worries, I was right now in the process of answering to your message.
For what is worth, there is a community supported
docker-composesysext too: https://github.com/flatcar/sysext-bakery/releases/tag/latest
Is this the best way to get docker compose working on flatcar? If yes, what is best practice to keep this plugin updated?
For what is worth, there is a community supported
docker-composesysext too: https://github.com/flatcar/sysext-bakery/releases/tag/latestIs this the best way to get docker compose working on flatcar? If yes, what is best practice to keep this plugin updated?
Hi @dan1el127, correct it's the best way to get docker compose on Flatcar. The URL has been updated to be more robust in the future. Here's the documentation on how to provision a Flatcar instance with Docker Compose: https://flatcar.github.io/sysext-bakery/docker_compose/
This section ensures that a new version of the sysext image is downloaded everytime a new one is made available:
storage:
files:
- path: /etc/sysupdate.docker-compose.d/docker-compose.conf
contents:
source: https://extensions.flatcar.org/extensions/docker-compose.conf
systemd:
units:
- name: systemd-sysupdate.timer
enabled: true
- name: systemd-sysupdate.service
dropins:
- name: docker-compose.conf
contents: |
[Service]
ExecStartPre=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/docker-compose.raw > /tmp/docker-compose"
ExecStartPre=/usr/lib/systemd/systemd-sysupdate -C docker-compose update
ExecStartPost=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/docker-compose.raw > /tmp/docker-compose-new"
ExecStartPost=/usr/bin/sh -c "if ! cmp --silent /tmp/docker-compose /tmp/docker-compose-new; then touch /run/reboot-required; fi"
Perfect thank u!
With docker compose being available as a sysext image, I don't think we will have it directly built-in into Flatcar. The documentation is here: https://flatcar.github.io/sysext-bakery/docker_compose/ - feel free to open an issue on the bakery if you run into any issues. Thanks everyone!