Install nsenter on the host, either by installing linux-utils
package or by following https://github.com/jpetazzo/nsenter#how-do-i-install-nsenter-with-this
Create a new user on the host box:
useradd -g docker docker-ssh
passwd docker-ssh
Set up sudoers for the docker-ssh user by appending the following to /etc/sudoers:
Cmnd_Alias NSENTER = /bin/nsenter --target * --mount --uts --ipc --net --pid
docker-ssh ALL=(root) NOPASSWD: NSENTER
Set up docker on the host to listen on tcp socket by adding -H tcp://0.0.0.0:4243
to either /etc/sysconfig/docker. This will probably be different depending on your Linux flavour/version.
Add the file below, docker-ssh
to your client's PATH.
Run docker-ssh DOCKER_HOST CONTAINER_ID
e.g.
docker-ssh localhost 2765ea52e7c5