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
• 15,260 points
134 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
• 34,440 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
840 views
+3 votes
13 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
8,619 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,890 points
347 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
618 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
• 34,440 points
1,293 views
0 votes
1 answer

How to install packages in a Docker container?

Hi@akhtar, To install packages in a docker container, ...READ MORE

answered Apr 15 in Docker by MD
• 34,440 points
1,121 views