|
https://github.com/lioncui/docker-static-ip
pip install docker-py
yum install bridge-utils -y
下载下来
cd docker-static-ip
python duration.py
echo "71792e4003d8,docker0,172.17.42.30/16,172.17.42.1" >> containers.cfg
#此处作者有错
formation: [container-id],[bridge-name],[ipaddress/netmask],[gateway]
这样容器启动就不会IP地址就不会丢失了
此处直接入容器直接生效 pipework 设置不冲突
[root@localhost docker-static-ip-master]# ps -ef|grep python
root 914 1 0 Jan07 ? 00:00:04 /usr/bin/python -Es /usr/sbin/tuned -l -P
root 6218 1 0 Jan07 pts/2 00:00:01 python duration.py #守护进程
root 10021 3149 0 00:18 pts/2 00:00:00 grep --color=auto python
[root@localhost docker-static-ip-master]# |
|
|