English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The virtual router project in openstack consumes too many resources, it is necessary to migrate the virtual router to Docker, and it is considered that several problems need to be solved first.
1. How to integrate docker into openstack, this issue has been given three solutions by the openstack official, based on nova, heat, and a separate container project
2. After integrating docker, the container management and orchestration decides to adopt K8S
3Is it possible to install quagga in docker, package it into a quagga image for subsequent development and automatic configuration programs?
Today, I tried to install quagga in docker and automatically start the processes of zebra, ripd, ospfd, and bgpdz. There are many online resources about docker installation and usage, please refer to them by yourself.
The image construction is automatically built according to the Dockerfile file, and then the container is run based on the built image.
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: lijianfeng/ubuntu:v1.0 base image is self-made, just like the official Ubuntu:14.04Common software packages are installed.
Create zebra.conf, ospfd.conf, ripd.conf, bgpd.conf in the same directory as Dockerfile, content is
hostname router
password zebra
enable password zebra //Only zebra.conf has it, others do not
log stdout
Create init_conf.sh in the same directory as Dockerfile, content 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
Image creation:
docker build -t lijianfeng/quagga .
Because the image is built in the same directory, the last one is . , otherwise an absolute path is required
Build completed, check through docker images, and lijianfeng will appear/quagga image
Container running, using pseudo-terminal interactive mode here
docker run -it --name router --hostname router --privileged=true lijianfeng/quagga
After the command is executed, it will enter the docker operation space, which can be accessed by telnet localhost <port> to enter the corresponding daemon process.
Thank you for reading, I hope it can help everyone, thank you for your support to this site!