net=host: remove /var/run/docker/netns/default from OCI config

Prior to this commit, a container running with `--net=host` had
`{"type":"network","path":"/var/run/docker/netns/default"}` in
the ``.linux.namespaces` field of the OCI Runtime Config,
but this wasn't needed.

Close issue 47100

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2024-01-18 18:05:27 +09:00
parent 4f9c865edd
commit ed15f1d717
No known key found for this signature in database
GPG key ID: 49524C6F9F638F1A

View file

@ -285,10 +285,7 @@ func WithNamespaces(daemon *Daemon, c *container.Container) coci.SpecOpts {
})
}
case networkMode.IsHost():
setNamespace(s, specs.LinuxNamespace{
Type: specs.NetworkNamespace,
Path: c.NetworkSettings.SandboxKey,
})
oci.RemoveNamespace(s, specs.NetworkNamespace)
default:
setNamespace(s, specs.LinuxNamespace{
Type: specs.NetworkNamespace,