Jerome Petazzoni of Docker, Inc. published an article on his company’s blog to show how people can get inside running Docker containers with a lightweight tool called
nsenter. By letting people enter the Linux kernel namespaces that Docker uses to build containers,
nsenter effectively gives them shell access to running Docker containers without SSH daemon.
To make entering a running Docker container even simpler, Docker, Inc. is introducing
docker exec with the release of Docker v1.3.0. The
docker exec command spawns a process inside a given Docker container. By using
docker exec to launch a new Bash session inside the running Docker container, developers can more easily debug their Dockerized applications.
Docker is not recommending users to abandon the “one application per container” development pattern with
docker exec. Instead, Docker hopes to wean them off the anti-pattern of running
sshd inside their containers.
With the introduction of
nsenter has officially become obsolete.