The virtual router project in OpenStack takes up too much resources and needs to migrate the virtual router to the Docker, so it is necessary to solve several problems first.
1. How to integrate Docker into OpenStack, this issue OpenStack officially given three programs, based on nova,heat, and individual container projects
2. After integrated Docker container management arrangement, decided to adopt k8s
3. Whether the quagga can be loaded into the Docker, packaged into a quagga mirror for the development of the automatic configuration program after two times.
Today, try to install Quagga in Docker and automatically open the ZEBRA,RIPD,OSPFD,BGPDZ process. Docker installation and use, a lot of information on the Internet, please check yourself.
The mirror build is built automatically according to the Dockerfile file and then run the container based on the built mirror.
Dockerfile
From lijianfeng/ubuntu:v1.0
maintainer Lijianfeng
run apt-get install-y quagga
RUN apt-get install-y Telnet
add zebra.conf/etc/quagga/zebra.conf
add ospfd.conf/etc/quagga/ospfd.conf
add ripd.conf/etc/ quagga/ripd.conf
Add bgpd.conf/etc/quagga/bgpd.conf
add init_conf.sh/etc/quagga/init_conf.sh
CMD sh/ etc/quagga/init_conf.sh; /bin/bash
Note:The lijianfeng/ubuntu:v1.0 base mirror was made by itself, but it was installed in the official ubuntu:14.04 of a commonly used package.
Create zebra.conf ospfd.conf ripd.conf bgpd.conf under the dockerfile sibling directory, content
Hostname router
Password zebra
Enable password zebra//Only zebra.conf there, nothing else
Log stdout
Dockerfile creates init_conf.sh under the same sibling directory, which is
#!/bin/bash
Sed-ri "S/hostname +/hostname $HOSTNAME/"/etc/quagga/zebra.conf
Sed-ri "S/hostname. +/hostname $HOSTNAME/"/etc/quagga/ripd.conf
sed-ri" S/hostname +/hostname $HOSTNAME/"/etc/quagga/ospfd.conf
Sed-ri" S/hostname. +/hostname $HOSTNAME/"/etc/quagga/bgpd.conf
chown-r quagga.quagga/etc/quagga
/usr/lib/quagga/ zebra-d
/usr/lib/quagga/ripd-d
/usr/lib/quagga/ospfd-d
/usr/lib/quagga/bgpd-d
Mirror production:
Docker build-t Lijianfeng/quagga.
Because the mirror is built at the same level, the last is. , otherwise an absolute path is required
Built, Docker images view, Lijianfeng/quagga mirroring appears
The container runs with pseudo terminal interactive mode
Docker run-it--name Router--hostname router--privileged=true lijianfeng/quagga
After the command executes, it enters the Docker operating space, which is available via telnet localhost <port> into the appropriate daemon.
Thank you for reading, I hope to help you, thank you for your support for this site!