Docker bootstrap unix sock is missing when reboot

6/11/2016

I use docker bootstrap Unix sock to deploy flannel network(source), which is missing after the computer reboot and the network restored to the state before the configuration.

OS ubuntu 14.04

docker version 1.11.2

step by step

1.Setup Docker Bootstrap

sudo sh -c 'docker daemon -H unix:///var/run/docker-bootstrap.sock -p /var/run/docker-bootstrap.pid --iptables=false --ip-masq=false --bridge=none --graph=/var/lib/docker-bootstrap 2> /var/log/docker-bootstrap.log 1> /dev/null &'

it warns that 'you should run the bootstrap Docker instance under something like SysV init, upstart or systemd so that it is restarted across reboots and failures.'

2.Startup etcd for flannel and the API server to use

sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
    --net=host \
    gcr.io/google_containers/etcd-amd64:${ETCD_VERSION} \
    /usr/local/bin/etcd \
        --listen-client-urls=http://127.0.0.1:4001,http://${MASTER_IP}:4001 \
        --advertise-client-urls=http://${MASTER_IP}:4001 \
        --data-dir=/var/etcd/data
sudo docker -H unix:///var/run/docker-bootstrap.sock run \
    --net=host \
    gcr.io/google_containers/etcd-amd64:${ETCD_VERSION} \
    etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'

I think it will restart all right if unix sock is exist, if a need to configure the default boot entry?

3.Set up Flannel bridge that Docker uses for networking

##Bring down Docker

sudo /etc/init.d/docker stop

##Run flannel

sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
    --net=host \
    --privileged \
    -v /dev/net:/dev/net \
    quay.io/coreos/flannel:${FLANNEL_VERSION} \
    /opt/bin/flanneld \
        --ip-masq=${FLANNEL_IPMASQ} \
        --iface=${FLANNEL_IFACE} 

sudo docker -H unix:///var/run/docker-bootstrap.sock exec 'really-long-hash-from-above-here' cat /run/flannel/subnet.env

##Edit the docker configuration

--bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}

##Remove the existing Docker bridge

sudo /sbin/ifconfig docker0 down

sudo brctl delbr docker0

##Restart Docker

sudo /etc/init.d/docker start

the same I think to the step 2

4.Starting the Kubernetes Master

sudo docker run \
    --volume=/:/rootfs:ro \
    --volume=/sys:/sys:ro \
    --volume=/var/lib/docker/:/var/lib/docker:rw \
    --volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
    --volume=/var/run:/var/run:rw \
    --net=host \
    --privileged=true \
    --pid=host \
    -d \
    gcr.io/google_containers/hyperkube-amd64:v${K8S_VERSION} \
    /hyperkube kubelet \
        --allow-privileged=true \
        --api-servers=http://localhost:8080 \
        --v=2 \
        --address=0.0.0.0 \
        --enable-server \
        --hostname-override=127.0.0.1 \
        --config=/etc/kubernetes/manifests-multi \
        --containerized \
        --cluster-dns=10.0.0.10 \
        --cluster-domain=cluster.local

It does not matter for the error

-- D cc
docker
flannel
kubernetes

0 Answers