Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save muriloloffi/faf2a7962a864efe0374763145257371 to your computer and use it in GitHub Desktop.
Save muriloloffi/faf2a7962a864efe0374763145257371 to your computer and use it in GitHub Desktop.
Simple Installer for Docker Compose on Container-Optimized OS on Google Computing Engine

Simple Installer for Docker Compose on Container-Optimized OS on Google Computing Engine

The easiest way to make Docker Compose available on Container-Optimized OS on Google Compute Engine (GCE) on Google Cloud Platform (GCP).

This is minimal Bash script version of Community Tutorial.

How to use

Simply, download installer.sh, run it, and then reload bash by source ~/.bashrc or re-login.

By default, 1.27.4 will be retrieved, but you can specify any version as an argument.

  • Install default version
curl -O https://gist.githubusercontent.com/kurokobo/25e41503eb060fee8d8bec1dd859eff3/raw/0d7cd29472f0eaa26ce424071456ad84b24fb318/installer.sh
bash ./installer.sh
source ~/.bashrc
docker-compose version
  • Install specific version
curl -O https://gist.githubusercontent.com/kurokobo/25e41503eb060fee8d8bec1dd859eff3/raw/0d7cd29472f0eaa26ce424071456ad84b24fb318/installer.sh
bash ./installer.sh 1.27.3
source ~/.bashrc
docker-compose version

Or you can invoke directly.

  • Install default version
curl -s https://gist.githubusercontent.com/kurokobo/25e41503eb060fee8d8bec1dd859eff3/raw/0d7cd29472f0eaa26ce424071456ad84b24fb318/installer.sh | bash
source ~/.bashrc
docker-compose version
  • Install specific version
curl -s https://gist.githubusercontent.com/kurokobo/25e41503eb060fee8d8bec1dd859eff3/raw/0d7cd29472f0eaa26ce424071456ad84b24fb318/installer.sh | bash /dev/stdin 1.27.3
source ~/.bashrc
docker-compose version
#!/bin/bash
VERSION=${1:-1.27.4}
echo "* Add an alias for docker-compose to the shell configuration file ..."
echo alias docker-compose="'"'docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$PWD:$PWD" \
-w="$PWD" \
docker/compose:'"${VERSION}"''"'" >> ~/.bashrc
echo "* Pull container image for docker-compose ..."
docker pull docker/compose:${VERSION}
echo "* Done"
echo "* To use docker-compose, run 'source ~/.bashrc' or simply re-login"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment