Score:1

How can I run docker container in existing network namespace?

sn flag

I have an existing network namespace:

dewi@dewiserver:~$ ip netns list
dewinetns235 (id: 0)

How can I get a docker container to use and run inside this network namespace?
e.g. run something like

docker run --rm curlimages/curl:7.81.0 --namespace dewinetns235 -L -v https://curl.haxx.se 

So in this instance I want the curl command to exist within the dewinetns235 network namespace

Many thanks

Score:1
cn flag

A quick google turns up this link. Looks like you attach the network namespace after running the container? I'm a bit surprised this isn't more built-in to Docker.

There is the --network flag to docker run but I suspect that's for Docker-created networks.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.