Docker Community Forums

Share and learn in the Docker community.

How to commit docker with new bridge network

I created a new bridge called nbridge.
The ip is 192.168.2.2 and able to ping google.com

docker run --network=nbridge -it --name=Runnbridge 0c69a48fe7c7
ip a
: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
9: eth0@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:c0:a8:02:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet **192.168.2.2**/24 brd 192.168.2.255 scope global eth0
       valid_lft forever preferred_lft forever
root@492b62710ec4:/# ping google.com
PING google.com (172.217.194.100) 56(84) bytes of data.
64 bytes from 172.217.194.100: icmp_seq=1 ttl=42 time=8.45 ms
64 bytes from 172.217.194.100: icmp_seq=2 ttl=42 time=7.19 ms

The container Id is 492b62710ec4
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 492b62710ec4 0c69a48fe7c7 "/bin/bash" 43 seconds ago Up 36 seconds Runnbridge

Commited this container 492b62710ec4
commit -m "new bridge" -a "me" 492b62710ec4 coka/newbridge

The new image as show docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
coka/newbridge latest 6b5b07e209db 58 seconds ago 174MB
coka/ubuntu-nodejs latest ce1fe42d2a23 5 days ago

Running the new image 6b5b07e209db
docker run -it 6b5b07e209db root@5069bc5fc5a8:/# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 11: eth0@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0 valid_lft forever preferred_lft forever

The newly added eth0@if10 was not found but replaced by the default.
Please help