How can I connect a docker container to two docker networks that I have created?

0 votes

Hi Guys,

I am working on a project. For that I used Docker container. By default every docker container uses bridge driver for networking. Can I use more than one driver in my docker container?

Thank You

Mar 23 in Docker by akhtar
• 4,500 points
70 views

1 answer to this question.

0 votes

Hi@akhtar,

It's correct that the network argument of the docker run command only supports one network. But we can connect another network card to our container.

Example:

create multiple networks

  1. docker network create --driver bridge net1
  2. docker network create --driver host net2

run the container using the initial network and connect it to the other network.

  1. docker run  -it --name Ubuntu --network net1 Ubuntu
  2. docker network connect net2 Ubuntu

Hope this will help you.

Thank You

answered Mar 23 by MD
• 8,870 points

Related Questions In Docker

+1 vote
0 answers

How can I map a docker location to my Jenkins workspace so that I can use the files in my Jenkins

Hey guys, I was trying to execute few ...READ MORE

Feb 25 in Docker by dineshkumar
• 130 points
225 views
+1 vote
12 answers
0 votes
2 answers

How to edit file after I shell to a docker container?

You can even install it using a ...READ MORE

answered Apr 23, 2019 in Docker by Ashish
5,918 views
0 votes
1 answer

Docker: Add a restart policy to a container that was already created

In recent versions of docker (as of ...READ MORE

answered Jul 30, 2018 in Docker by Kalgi
• 51,830 points
163 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 57,530 points
447 views
0 votes
1 answer

How can I install systemctl tool in Docker container?

Hi@akhtar, In docker container if you want to ...READ MORE

answered Feb 5 in Docker by MD
• 8,870 points
205 views
0 votes
1 answer

How do I fix a docker permission denied error on Centos?

Hi@akhtar, This is because of docker permission for ...READ MORE

answered Mar 23 in Docker by MD
• 8,870 points
68 views