Skip to content

andock/ssh2container

 
 

Repository files navigation

Latest Release Build Status

alt text

ssh2container

ssh2container is a ssh server which connects you directly to your docker container via ssh.

  • Supports TTY
  • Supports drush / rsync / scp
  • Supports sftp (for phpStorm)

Sample:

Connect to the cli container of project

    ssh project@192.168.64.100 -p 2222

Connect to the mysql container of project

    ssh project---mysql@192.168.64.100 -p 2222

For phpStorm

E.g. To connect phpStorm via ssh.

Startup:

docker run \
-d \
-e "HOST_UID=$(id -u)" \
-e "HOST_GID=$(cut -d: -f3 < <(getent group docker))" \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/bin/docker:/usr/bin/docker \
--name andock-ssh2container \
--mount type=bind,src=${HOME}/.ssh/authorized_keys,dst=/home/docker/.ssh/authorized_keys \
-p 192.168.64.100:2222:2222 andockio/ssh2container --auth-type noauth

Add remote debugger

alt text

Add phpcs

alt text

Debug mode:

docker run \
-e "HOST_UID=$(id -u)" \
-e "HOST_GID=$(cut -d: -f3 < <(getent group docker))" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/bin/docker:/usr/bin/docker \
--name andock-ssh2container \
-p 192.168.64.100:2222:2222 andockio/ssh2container --auth-type noauth --verbose

For sandbox servers:

E.g. to run drush sql-sync.

Startup:

docker run \
-d \
-e "HOST_UID=$(id -u)" \
-e "HOST_GID=$(cut -d: -f3 < <(getent group docker))" \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/bin/docker:/usr/bin/docker \
-v ${HOME}/.ssh/authorized_keys:/home/docker/.ssh/authorized_keys:rw \
--name andock-ssh2container \
-p 0.0.0.0:2222:2222 andockio/ssh2container 

Login:

    ssh project@192.168.64.100 -p 2222

alt text

About

go ssh server to access docker container

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 87.2%
  • Shell 7.1%
  • Dockerfile 2.3%
  • Makefile 2.2%
  • PHP 1.2%