Skip to content

Instantly share code, notes, and snippets.

@sourcec0de
Created November 30, 2015 19:39
Show Gist options
  • Save sourcec0de/5cf7d36a5f696c2ffc68 to your computer and use it in GitHub Desktop.
Save sourcec0de/5cf7d36a5f696c2ffc68 to your computer and use it in GitHub Desktop.
Install docker compose on coreos
sudo su -
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.5.1/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@xavier-fernandez
Copy link

With Docker-compose 1.10.0:

sudo su -
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.10.0/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose

@ciecierski
Copy link

With Docker-compose 1.11.1:
sudo su -
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.11.1/docker-compose-`uname -s-uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose

@gt50
Copy link

gt50 commented Mar 22, 2017

Version 1.11.2:
sudo su -
mkdir -p /opt/bin
curl -L "https://github.com/docker/compose/releases/download/1.11.2/docker-compose-$(uname -s)-$(uname -m)" -o /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose

@soerenmartius
Copy link

soerenmartius commented Jun 2, 2017

Version 1.14.0-rc1:

sudo su -
mkdir -p /opt/bin
curl -L "https://github.com/docker/compose/releases/download/1.14.0-rc1/docker-compose-$(uname -s)-$(uname -m)" -o /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose

if you run into this exception after installing
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

you might wanna grant your current user the right permissions instead of using sudo:
sudo gpasswd -a ${USER} docker

This will add the current user to the group docker

@rbucker
Copy link

rbucker commented Feb 9, 2018

version 1.19.0

sudo su -
mkdir -p /opt/bin
curl -L "https://github.com/docker/compose/releases/download/1.19.0/docker-compose-$(uname -s)-$(uname -m)" -o /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose

no real point in this... just for fun.

@daveneeley
Copy link

Use a container linux file instead of a bash script

  files:
    - path: /opt/bin/docker-compose
      filesystem: root
      mode: 0744
      contents:
        remote:
          url: https://github.com/docker/compose/releases/download/1.21.2/docker-compose-Linux-x86_64
          verification:
            hash:
              function: sha512
              sum: 5A9CCBE01CBF585732907F38FBACC21AECD2EDC9351BD1EE91DF750740A7FFF9D73BD489D708087D9D8892AD8F448A78A8EE401D240A51D0202ED0C08E30BF88

@artheus
Copy link

artheus commented Jun 15, 2018

I made a tiny script based on this, for installing the latest release

#!/bin/bash

LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest`
COMPOSE_VERSION=${LATEST_URL##*/}
DOWNLOAD_URL=https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m`

curl -L ${DOWNLOAD_URL} -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Just getting the redirect link from https://github.com/docker/compose/releases/latest and checking the tag name, which maps directly to the release version.

@juris
Copy link

juris commented Jul 13, 2018

@artheus /usr/local/bin is read-only for CoreOS

@u007
Copy link

u007 commented Feb 1, 2019

modified artheus to use /opt/bin,
requires sudo

#!/bin/bash

mkdir -p /opt/bin
LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest`
COMPOSE_VERSION=${LATEST_URL##*/}
DOWNLOAD_URL=https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m`

curl -L ${DOWNLOAD_URL} -o /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose

@KEINOS
Copy link

KEINOS commented Apr 10, 2019

The Container Linux Config (cl.conf) based on daveneeley's conf which worked with:

  • Ignition v2.2.0, Vagrant 2.2.4, VirtualBox v6.0.4r128413, HOST: macOS Mojave(OSX 10.14.4), GUEST: Container Linux by CoreOS stable (2023.5.0)
storage:
  files:
    - path: /opt/bin/docker-compose
      filesystem: root
      mode: 0755
      contents:
        remote:
          url: https://github.com/docker/compose/releases/download/1.21.2/docker-compose-Linux-x86_64
          verification:
            hash:
              function: sha512
              sum: 5A9CCBE01CBF585732907F38FBACC21AECD2EDC9351BD1EE91DF750740A7FFF9D73BD489D708087D9D8892AD8F448A78A8EE401D240A51D0202ED0C08E30BF88
The complete conf (cl.conf)

Transpile it to config.ign with ct before use.

etcd:
  name:                        "{HOSTNAME}"
  listen_peer_urls:            "http://{PRIVATE_IPV4}:2380"
  listen_client_urls:          "http://0.0.0.0:2379"
  initial_advertise_peer_urls: "http://{PRIVATE_IPV4}:2380"
  advertise_client_urls:       "http://{PRIVATE_IPV4}:2379"
  discovery:                   "https://discovery.etcd.io/<REPLACE HERE TO YOUR TOKEN>"

storage:
  files:
    - path: /opt/bin/docker-compose
      filesystem: root
      mode: 0755
      contents:
        remote:
          url: https://github.com/docker/compose/releases/download/1.21.2/docker-compose-Linux-x86_64
          verification:
            hash:
              function: sha512
              sum: 5A9CCBE01CBF585732907F38FBACC21AECD2EDC9351BD1EE91DF750740A7FFF9D73BD489D708087D9D8892AD8F448A78A8EE401D240A51D0202ED0C08E30BF88

systemd:
  units:
    - name: docker-tcp.socket
      enable: true
      contents: |
        [Unit]
        Description=Docker Socket for the API

        [Socket]
        ListenStream=2375
        Service=docker.service
        BindIPv6Only=both

        [Install]
        WantedBy=sockets.target
    - name: flanneld.service
      dropins:
        - name: 50-network-config.conf
          contents: |
            [Service]
            ExecStartPre=/usr/bin/etcdctl set /flannel/network/config '{ "Network": "10.1.0.0/16" }'

flannel:
  etcd_prefix: "/flannel/network"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment