docker-sshd -


MIT
Linux
Google Go

软件简介

docker-ssh 可以让你直接 ssh 到 docker 容器里边 并且不需要 容器 启动 sshd

+-------------+                                                                 
|             |    ssh CONTAINER1@docker-sshd      +--------------------+       
|     ops     +------------------------------------>                    |       
|             |                                    |    docker-sshd     |       
+-------------+                                    |                    |       
                                                   +----------------+---+       
                                                                    |           
                                                                    |           
                              docker exec -ti CONTAINER1 /bin/bash  |           
                                                                    |           
                +--------------------------------------------------------------+
                |                                                   |          |
                | Docker   +------------+  +------------+    +------v-----+    |
                |          |            |  |            |    |            |    |
                |          | CONTAINER3 |  | CONTAINER2 |    | CONTAINER1 |    |
                |          |            |  |            |    |            |    |
                |          +------------+  +------------+    +------------+    |
                |                                                              |
                +--------------------------------------------------------------+

安装

go get github.com/tg123/docker-sshd

例子

  1. 启动一个 叫 CONTAINER1的容器

    docker run -d -t --name CONTAINER1 ubuntu top
    

    bd78d93154cff5e8b40d19b1676670a49f582d2522384ecfe0d9e7d60846891e

  2. 运行docker-sshd

    $GOPATH/bin/docker-sshd
    
  3. 使用 CONTAINER1 作为用户名链接 就可以使用了

    ssh CONTAINER1@127.0.0.1 -p 2232
    

    root@bd78d93154cf:/#