Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fleet services for switching to latest docker on CoreOS, and back again
# core-docker.service
# Fleet global unit to restore docker to the CoreOS version
[Unit]
Wants=docker.service
After=docker.service
[Service]
Type=oneshot
ExecStart=/usr/bin/rm -f /run/systemd/system/docker.service.d/10-start.conf
ExecStart=/usr/bin/echo "Default docker daemon restored"
ExecStart=/bin/bash -c 'nohup bash -c "/usr/bin/systemctl daemon-reload; /usr/bin/systemctl restart docker.service;" & sleep 1;'
[X-Fleet]
Global=true
# latest-docker.service
# Fleet global unit to update docker to the latest (or non-release) version
[Unit]
Wants=docker.service
After=docker.service
[Service]
Type=oneshot
# These can be configured to fix the the commit to use, or to ride master
Environment="COMMITISH=e7a9662974ad12e1926599e64dca44aaf1a90145"
Environment="BRANCH=master"
ExecStart=/bin/bash -c '[ -x /var/bin/docker ] || \
docker run --privileged --rm \
-v /tmp/docker-bundles:/go/src/github.com/docker/docker/bundles \
docker-dev:latest \
bash -c "git checkout ${BRANCH} && git pull && git checkout ${COMMITISH} && hack/make.sh binary || echo build failed";'
ExecStart=/usr/bin/mkdir -p /var/bin
ExecStart=/usr/bin/cp /tmp/docker-bundles/1.2.0-dev/binary/docker-1.2.0-dev /var/bin/docker
ExecStart=/usr/bin/mkdir -p /run/systemd/system/docker.service.d
ExecStart=/bin/bash -c 'echo "[Service]\nExecStart=\nExecStart=/var/bin/docker --daemon --storage-driver=btrfs --host=fd://" > /run/systemd/system/docker.service.d/10-start.conf'
ExecStart=/usr/bin/echo "Docker set to run from /var/bin/docker"
ExecStart=/bin/bash -c 'nohup bash -c "/usr/bin/systemctl daemon-reload; /usr/bin/systemctl restart docker.service;" & sleep 1;'
[Install]
WantedBy=multi-user.target
[X-Fleet]
Global=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.