Last active
March 28, 2019 00:49
-
-
Save Yasushi/19cf33347580b3b8f642c4e1812de810 to your computer and use it in GitHub Desktop.
boot2docker static ip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
kill `cat /var/run/udhcpc.eth0.pid` | |
ifconfig eth0 192.168.0.100 netmask 255.255.255.0 up | |
ip route add default via 172.168.0.1 dev eth0 | |
echo nameserver 8.8.8.8 >> /etc/resolv.conf | |
#/mnt/sda1/var/lib/boot2docker/bootlocal.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DOCKER_TLS=no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We can set permanet ip address for docker machine in two way:
Option 1:
Start the docker machine then use below command:
[suresh@suresh ~]$ docker-machine start manager1
echo "ifconfig eth1 netmask broadcast " | docker-machine ssh sudo tee /var/lib/boot2docker/bootsync.sh > /dev/null
echo "ifconfig eth1 192.168.99.100 netmask 255.255.255.0 broadcast 192.168.99.255 up" | docker-machine ssh manager1 sudo tee /var/lib/boot2docker/bootsync.sh > /dev/null
Restart docker machine:
[suresh@suresh ~]$ docker-machine stop worker1
[suresh@suresh ~]$ docker-machine start worker1
Veify ip address:
[suresh@suresh ~]$ docker-machine ip worker1
192.168.99.100
Option 2:
Start the docker machine then connect to docker machine and make the following changes:
[suresh@suresh ~]$ docker-machine start worker1
[suresh@suresh ~]$ docker-machine ssh worker1
Create the bootsync.sh file and make following changes:
docker@worker1:~$ sudo vi /var/lib/boot2docker/bootsync.sh
ifconfig eth1 192.168.99.101 netmask 255.255.255.0 broadcast 192.168.99.255 up
[suresh@suresh ~]$ docker-machine stop worker1
[suresh@suresh ~]$ docker-machine start worker1
Veify ip address:
[suresh@suresh ~]$ docker-machine ip worker1
192.168.99.101