As we know, while starting the container, by default, Docker creates six different namespaces: Process, Network, Mount, Hostname, Shared Memory, and User, for a container. In some cases, we might want to share a namespace between two or more containers. For example, in Kubernetes, all containers in a pod share the same network namespace.
In some cases, we might want to share the namespaces of the host system with the containers. For example, we share the same network namespace between the host and the container to get near line speed inside the container. In this recipe, we will see how to share namespaces between the host and the container.