Share & learn

Through Innovative Digital Library

How to add New network in running docker container.

We have upcoming network requirement to add 192.168.0.0/24 series IP address. Could you please suggest how to add them into running container.
 



Answers

Posted by Alex on February 3rd 2018 23:31 PM

Writing below steps for your considerations. Step 1: We presumed container is running with bridge IP so need to extract IP informtaion. Step 2: You can use network connect command with ip address and bridge name to add new IP to container Step 3: Afterwards please run docker inspect command to check if new IP address has been added with new bridge as expected. Step 4: Now you can disconnect the existing bridge but please carefull it might have adverse impact on running container.

# docker container inspect --format="{{.NetworkSettings.Networks.bridge.IPAddress}}" newname

# docker network connect --ip=192.168.0.28 newbridge newname

# docker container inspect --format="{{.NetworkSettings.Networks.newbridge.IPAddress}}" newname

# docker network disconnect bridge newname
Answer Question

Your email address will not be published. Required fields are marked *

  • Minimum 20 character
1UG5

related questions

Most liked questions

Most answered questions

Login
1UG5 Refresh
Register
1UG5 Refresh
Forgot password
Ask a Question
Minimum 20 character
Minimum 20 character
Reply
Minimum 20 character
1UG5 Refresh