prkz.de - Blog


Keep it simple

Make docker-machine docker host use a static ip address

written on 19 October 2017
Boot2docker runs the `/var/lib/boot2docker/bootsync.sh` script when booting. You can use this file to setup a static ip address and default gateway during boot: ```bash $ cat <<EOF | docker-machine ssh docker-host sudo tee /var/lib/boot2docker/bootsync.sh > /dev/null ifconfig eth0 10.0.0.10 netmask 255.255.255.0 broadcast 10.0.0.255 up ip route add default via 10.0.0.1 EOF ``` After modifying this file, restart the host, verify its settings and regenerate client-certificates ```bash $ docker-machine restart docker-host $ docker-machine env docker-host $ docker-machine regenerate-certs docker-host ```