Just a quick fun experiment to try to make docker-compose
work as a Docker CLI plugin
- docker/cli#1534 CLI Plugins Design
- docker/cli#1564 Basic framework for writing and running CLI plugins
To use it (assuming you have docker compose installed):
-
download a and install nightly build of the docker cli (linux macOS)
-
create the plugins directory
mkdir -p ~/.docker/cli-plugins
-
download the "plugin", and save it as
~/.docker/cli-plugins/docker-compose
(note: no.sh
extension!)curl https://gist.githubusercontent.com/thaJeztah/b7950186212a49e91a806689e66b317d/raw/36d4c5854523502deed5b56842b0d34cd6ec0f70/docker-compose-plugin.sh > ~/.docker/cli-plugins/docker-compose
-
make it executable
chmod +x ~/.docker/cli-plugins/docker-compose
-
run the
help
command on the nightly docker cli to verify the plugin was installed./docker help ... Commands: build Build an image from a Dockerfile compose (Docker) Define and run multi-container applications login Log in to a Docker registry logout Log out from a Docker registry
-
enjoy!
./docker compose help Define and run multi-container applications with Docker. Usage: docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...] docker-compose -h|--help Options: -f, --file FILE Specify an alternate compose file (default: docker-compose.yml) -p, --project-name NAME Specify an alternate project name
Yeah, it's not necessary for docker-compose anymore, but your little shell script was super useful to experiment with the CLI plugin concept, since it makes it really easy to answer the metadata request correctly.
Side note, your link to the nightly build for the Linux cli didn't have any packages newer than 2019. Did you mean to link to
https://download.docker.com/linux/static/test/aarch64/
? That directory includes much newer builds, including docker-22.06.0-beta.0.tgz dated June 6, 2022 (a week ago as of this writing).