66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
#cloud-config
|
|
merge_how: dict(recurse_array)+list(append)
|
|
write_files:
|
|
- path: /etc/systemd/system/docker.service
|
|
owner: "root:root"
|
|
permissions: "0644"
|
|
content: |
|
|
[Unit]
|
|
Description=Docker Application Container Engine
|
|
Documentation=http://docs.docker.com
|
|
After=network.target docker.socket wait-for-flanneld.service
|
|
Requires=docker.socket wait-for-flanneld.service
|
|
|
|
[Service]
|
|
Type=notify
|
|
EnvironmentFile=-/etc/sysconfig/docker
|
|
EnvironmentFile=-/etc/sysconfig/docker-storage
|
|
|
|
# This EnvironmentFile is required.
|
|
EnvironmentFile=/run/flannel/subnet.env
|
|
|
|
# This works around https://github.com/docker/docker/issues/9468
|
|
Environment=DOCKER_CERT_PATH=/etc/docker
|
|
|
|
ExecStart=/usr/bin/docker -d -H fd:// --bip $FLANNEL_SUBNET --mtu $FLANNEL_MTU $OPTIONS $DOCKER_STORAGE_OPTIONS
|
|
Restart=on-failure
|
|
LimitNOFILE=1048576
|
|
LimitNPROC=1048576
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
- path: /usr/local/bin/wait-for-flanneld
|
|
owner: "root:root"
|
|
permissions: "0755"
|
|
content: |
|
|
#!/bin/sh
|
|
|
|
# This script waits for flannel to provide the /run/flannel/subnet.env
|
|
# file. This can be used to synchronize docker startup with the
|
|
# availability of this file.
|
|
|
|
while ! [ -f /run/flannel/subnet.env ]; do
|
|
echo "waiting for flanneld"
|
|
sleep 1
|
|
done
|
|
|
|
echo "flanneld is active"
|
|
|
|
exit 0
|
|
- path: /etc/systemd/system/wait-for-flanneld.service
|
|
owner: "root:root"
|
|
permissions: "0644"
|
|
content: |
|
|
[Unit]
|
|
Description=Wait for flanneld to provide subnet/mtu information
|
|
After=network.target flanneld.service
|
|
Requires=flanneld.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/usr/local/bin/wait-for-flanneld
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
|