Perform the following steps:
- To share the host network namespace with the container, run the following command:
$ docker container run -it --net=host alpine ash
If you see the network details inside the container, run the following command:
$ ip a
You will see a result the same as the host:
- To share the host network, PID, and IPC namespaces with the container, run the following command:
$ docker container run -it --net=host --pid=host --ipc=host alpine ash