Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
static #docker binary in #coreos
#!/bin/bash
VERSION=$(docker --version | awk '{print $3}' | sed 's/,//')
BINARY="/opt/bin/docker-$VERSION-static"
LINK="/opt/bin/docker.static"
if [ ! -e "$BINARY" ]; then
curl -L -o "$BINARY" "https://get.docker.com/builds/Linux/x86_64/docker-$VERSION"
chmod a+x "$BINARY"
ln -sf "$BINARY" "$LINK"
fi
[Unit]
Description=Static docker downloader
Requires=docker.service
Before=docker.service
[Service]
Type=oneshot
ExecStart=/opt/bin/get-static-docker
[Install]
WantedBy=docker.service
@jfchevrette
Copy link

Just stumbled upon this & I'm wondering why would I want a static docker binary on my CoreOS servers?

@sigma
Copy link
Author

sigma commented Oct 25, 2015

@jfchevrette this is useful for cases where you want to use docker-in-docker, and be guaranteed that the inner one is compatible with the outer one (since docker basically doesn't have any useful notion of compatibility).

With this, you can just bind-mount the static docker binary, and you get those properties

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