This is a container inspired by:
Basically it acts like an ssh proxy/gateway, allowing you to execute bash commands into any container by mapping a ssh-key (see Usage) to the destination container.
There's no need to have OpenSSH installed at the destination since I'm using
docker exec -it $containeridOrName bash to access the bash.
There's also no need to link the containers to this image, thanks to docker-gen.
To run it:
$ docker run -d -p 22:2222 -v /var/run/docker.sock:/tmp/docker.sock sandrosalles/sshd-proxy
Then start any containers you want proxied with an Env var
SSHD_PROXY_KEY=ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIB0Kt3iWRVEH+lW4+H5Tfaa26 ...
$ docker run -e SSHD_PROXY_KEY=ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIB0Kt3iWRVEH+lW4+H5Tfaa26 ...
If you want to have ssh access to the ssh-proxy container itself you can pass an Env var
$ docker run -d -p 22:2222 -v /var/run/docker.sock:/tmp/docker.sock sandrosalles/sshd-proxy -e AUTHORIZED_KEYS=ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIB0Kt3iWRVEH+lW4+H5Tfaa26 ...,ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIB0Kt3iWRdfsfsdfsVEH+lW6876fsdfasd76fa ...
As mentioned before, as this container does not depend on or use OpenSSH to access the proxied containers you won't be able to use it to SFTP into them (nor should you).
Usage on Tutum.co
Things to remember when using this container on Tutum.co:
- Add an entry to the volumes section matching
- Run this container in privileged mode as it uses docker internally to bash into the proxied containers
- Give it Full access on Environment variables/API Roles