You could earn up to $300 by adding new articles!

Get Started Now

Installing docker-compose on CoreOS

Published on: Mon, Nov 13, 2017 at 4:39 pm EST

This article explains how to install docker-compose on CoreOS. In CoreOS, the /usr/ folder is immutable so the standard /usr/local/bin path is unavailable for running binaries. The /opt/bin directory, however, is available for these files.

Installation

First, verify that /opt/bin is in your environment $PATH.

docker-host ~ # echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/bin

If /opt/bin is not listed, as the root user, create or modify the file /root/.bash_profile and add the following:

PATH=$PATH:/opt/bin

Then run source /root/.bash_profile to pick up the new configuration. It will be applied automatically whenever you login to the shell.

To download the latest stable version of docker-compose, run the following commands in a bash script or one line at a time at the command line:

export DOCKER_COMPOSE_VERSION=`git ls-remote --tags git://github.com/docker/compose.git | awk '{print $2}' |grep -v "docs\|rc" |awk -F'/' '{print $3}' |sort -V |tail -n1`

curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose

chmod +x /opt/bin/docker-compose

If you'd rather specify a version, set DOCKER_COMPOSE_VERSION to a valid docker-compose version.

Verify that the file is available by typing:

which docker-compose

If the configuration was successful, you will see the output:

/opt/bin/docker-compose

Verify the version by running docker-compose -v.

This concludes my tutorial. For alternative installation methods, consult the Docker documentation.

Want to contribute ?

You could earn up to $300 by adding new articles!

Get started in the SSD Cloud!