I have a dockefile that builds a GoBGP Speaker image.
Here is the dockerfile
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y \
wget \
iputils-ping \
traceroute \
tcpdump \
iproute2 \
&& rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/osrg/gobgp/releases/download/v1.25/gobgp_1.25_linux_amd64.tar.gz && \
tar zxvf gobgp_1.25_linux_amd64.tar.gz && \
mv gobgp* /usr/bin/
RUN mkdir -p /opt/gobgp
WORKDIR /opt/gobgp/
COPY docker/gobgp/configs/* ./configs/
CMD ["gobgpd"]
EXPOSE 50051
I also have a docker-compose that will bring an entire gobgp network topology. I'm trying to execute multiple commands on the gobgp_1 service:
gobgp_1:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
command: sh -c "gobgpd -f configs/gobgpd_1.conf ; gobgp global rib add -a ipv4 11.8.0.0/24
; gobgp global rib add -a ipv4 11.7.0.0/24
; gobgp global rib add -a ipv4 11.6.0.0/24
; gobgp global rib add -a ipv4 11.5.0.0/24
"
privileged: true
networks:
net5:
ipv4_address: 11.8.0.2
net6:
ipv4_address: 11.7.0.2
net7:
ipv4_address: 11.6.0.3
net8:
ipv4_address: 11.5.0.3
The gobgpd -f configs/gobgpd_1.conf command ran successfully, but the rest of the command run, but it did not take effect on the gobgpd application. If I run the commands manually by jumping into the container bash, the command runs successfully, and I see the change on the gobgpd application.
To give you some context of what I am expecting When I should see some information when I use the following command:
gobgp global rib
But I don't see anything after bringing the docker-compose up. Otherwise, If I manually run When I run the commands, I see the expected information.
Here is my entire docker-compose file.
version: '3'
services:
isp_1:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
command: "gobgpd -f configs/isp_1.conf"
privileged: true
networks:
net1:
ipv4_address: 9.0.0.3
isp_2:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
command: "gobgpd -f configs/isp_2.conf"
privileged: true
networks:
net2:
ipv4_address: 8.0.0.3
gobgp_5:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
command: "gobgpd -f configs/gobgpd_5.conf"
privileged: true
networks:
net2:
ipv4_address: 8.0.0.2
net4:
ipv4_address: 11.10.0.3
gobgp_4:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
command: "gobgpd -f configs/gobgpd_4.conf"
privileged: true
networks:
net1:
ipv4_address: 9.0.0.2
net3:
ipv4_address: 11.0.0.3
gobgp_3:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
command: "gobgpd -f configs/gobgpd_3.conf"
privileged: true
networks:
net4:
ipv4_address: 11.10.0.2
net6:
ipv4_address: 11.7.0.3
gobgp_2:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
command: "gobgpd -f configs/gobgpd_2.conf"
privileged: true
networks:
net3:
ipv4_address: 11.0.0.2
net5:
ipv4_address: 11.8.0.3
gobgp_1:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
command: sh -c "gobgpd -f configs/gobgpd_1.conf ; gobgp global rib add -a ipv4 11.8.0.0/24
; gobgp global rib add -a ipv4 11.7.0.0/24
; gobgp global rib add -a ipv4 11.6.0.0/24
; gobgp global rib add -a ipv4 11.5.0.0/24
"
privileged: true
networks:
net5:
ipv4_address: 11.8.0.2
net6:
ipv4_address: 11.7.0.2
net7:
ipv4_address: 11.6.0.3
net8:
ipv4_address: 11.5.0.3
server_1:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
privileged: true
networks:
net7:
ipv4_address: 11.6.0.2
controller_1:
build:
context: ./
dockerfile: ./docker/gobgp/Dockerfile
privileged: true
networks:
net8:
ipv4_address: 11.5.0.2
networks:
net1:
driver: bridge
ipam:
driver: default
config:
- subnet: 9.0.0.0/24
net2:
driver: bridge
ipam:
driver: default
config:
- subnet: 8.0.0.0/24
net3:
driver: bridge
ipam:
driver: default
config:
- subnet: 11.0.0.0/24
net4:
driver: bridge
ipam:
driver: default
config:
- subnet: 11.10.0.0/24
net5:
driver: bridge
ipam:
driver: default
config:
- subnet: 11.8.0.0/24
net6:
driver: bridge
ipam:
driver: default
config:
- subnet: 11.7.0.0/24
net7:
driver: bridge
ipam:
driver: default
config:
- subnet: 11.6.0.0/24
net8:
driver: bridge
ipam:
driver: default
config:
- subnet: 11.5.0.0/24