百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

ssh2docker

> DevOps
开源

:whale: 独立的 SSH 服务器,可连接到您的 Docker 容器

198 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

:whale: 独立的 SSH 服务器,可连接到您的 Docker 容器

ssh2docker

:wrench: SSH server that can create new Docker containers and/or join existing ones, with session, and dynamic configuration support

SSH chroot with steroids

…

Usage

…

Example

Server

bash
$ ssh2docker
INFO[0000] Listening on port 2222
INFO[0001] NewClient (0): User="alpine", ClientVersion="5353482d322e302d4f70656e5353485f362e362e317031205562756e74752d327562756e747532"
INFO[0748] NewClient (1): User="ubuntu", ClientVersion="5353482d322e302d4f70656e5353485f362e362e317031205562756e74752d327562756e747532"

Client

bash
$ ssh localhost -p 2222 -l alpine
Host key fingerprint is 59:46:d7:cf:ca:33:be:1f:58:fd:46:c8:ca:5d:56:03
+--[ RSA 2048]----+
|          . .E   |
|         . .  o  |
|          o    +.|
|         +   . .*|
|        S    .oo=|
|           . oB+.|
|            oo.+o|
|              ...|
|              .o.|
+-----------------+

alpine@localhost's password:
/ # cat /etc/alpine-release
3.2.0
/ # ^D
bash
$ ssh localhost -p 2222 -l ubuntu
Host key fingerprint is 59:46:d7:cf:ca:33:be:1f:58:fd:46:c8:ca:5d:56:03
+--[ RSA 2048]----+
|          . .E   |
|         . .  o  |
|          o    +.|
|         +   . .*|
|        S    .oo=|
|           . oB+.|
|            oo.+o|
|              ...|
|              .o.|
+-----------------+

ubuntu@localhost's password:
# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.3 LTS
Release:	14.04
Codename:	trusty
# ^D

Install

Install latest version using Golang (recommended)

bash
$ go get github.com/moul/ssh2docker/cmd/ssh2docker

Install latest version using Homebrew (Mac OS X)

bash
$ brew install https://raw.githubusercontent.com/moul/ssh2docker/master/contrib/homebrew/assh.rb --HEAD

or the latest released version

bash
$ brew install https://raw.githubusercontent.com/moul/ssh2docker/master/contrib/homebrew/assh.rb

Test with Docker

You can test ssh2docker within Docker, but you will have some limitations, i.e: cannot run with boot2docker.

Here is an example about how to use ssh2docker inside Docker

bash
$ docker run --privileged -v /var/lib/docker:/var/lib/docker -it --rm -p 2222:2222 moul/ssh2docker

Changelog

master (unreleased)

  • Support of docker-exec-args in hook scripts and in CLI args
  • Sending environment variables to auth scripts
  • TTY is now dynamic (@quentinperez)
  • Support of exec commands without tty, i.e: git-server, rsync, tftp, ...
  • Support of API hooks for password and public key authentication (#80)
  • Support of exec requests (#51)
  • Support of docker-run-args in hook scripts (#30)
  • Support of --syslog-server + refactored logs (#71)
  • Do not ask for a password if only --publickey-auth-script is present (#72)
  • Code refactor (split in modules), update examples, bump dependencies
  • Support of --syslog-server=unix:///dev/log (#74)

full commits list

v1.2.0 (2015-11-22)

  • Support of --host-key=system to use OpenSSH keys (#45)
  • Support of custom entrypoint (#63)
  • Support of public-key authentication (#2)
  • Handling custom environment variables, user and command in password script (#57)
  • Replacing "_" by "/" on default image name to handle ControlMaster on clients
  • Support of --banner option (#26)
  • Add a not-yet-implemented warning for exec (#51)
  • Support of --local-user option, to allow a specific user to be a local shell (#44)
  • Kill connection when exiting shell (ctrl+D) (#43)

full commits list

v1.1.0 (2015-10-07)

  • Fix runtime error on Linux (#38)
  • Initial version of the native Scaleway support (#36)
  • Support of 'ssh2docker --password-auth-script' options (#28)
  • Add docker support (#17)
  • Add GOXC support to build binaries for multiple architectures (#18)
  • Support of 'ssh2docker --clean-on-startup' (#23)
  • Add homebrew support (#16)
  • Add Changelog (#19)

full commits list

v1.0.1 (2015-09-27)

  • Using party to manage dependencies

full commits list

v1.0.0 (2015-09-27)

Initial release

Features

  • Basic logging
  • Handling environment-variable requests
  • Support of --allowed-images option (#4)
  • Ability to configure docker run arguments (#13)
  • Reconnecting to existing containers (#14)
  • Support of --no-join option (#6)

full commits list

License

MIT

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Godockergatewayhook-scriptssh

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理