macから、vagrantのcentosをproxyにして、vagrant上に作ったdockerのコンテナにSSHしたい
お世話になります
dockerを試して見たく、さらに、SSHプロキシを試してみたく、いま調べております
そこで以下のサイトを参考にしました
MacからSSH接続可能なDockerコンテナを作る。 - Less is Best
現状ですが、vagrantのCentOS内で、Dockerfileを使ってbuildするところで、最後にこけています
sudo docker build -t "shiratsu/docker_sshd" .
2015/01/27 02:21:48 Unknown filesystem type on /dev/mapper/docker-253:0-17040161-9e50380ebda65fe7f1061951d8a9448ef2fda5807957caf1faef9c72e68b4774
色々調べてはいるものの、解決はせずでして。。。
ちなみに、dockerの情報は以下です
[shiratsu@localhost ~]$ sudo docker info
Containers: 1
Images: 5
Storage Driver: devicemapper
Pool Name: docker-253:0-17040161-pool
Pool Blocksize: 65.54 kB
Data file: /var/lib/docker/devicemapper/devicemapper/data
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
Data Space Used: 89.19 MB
Data Space Total: 107.4 GB
Metadata Space Used: 1.192 MB
Metadata Space Total: 2.147 GB
Library Version: 1.02.89-RHEL6 (2014-09-01)
Execution Driver: native-0.2
Kernel Version: 2.6.32-358.el6.x86_64
Operating System: <unknown>
OSがunknownなのも気になりますが。。。
その他OS情報はこちらです
[shiratsu@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[shiratsu@localhost ~]$ df -h
Filesystem Size Used Avail Use% マウント位置
/dev/mapper/VolGroup-lv_root
490G 1.7G 463G 1% /
tmpfs 230M 0 230M 0% /dev/shm
/dev/sda1 485M 32M 429M 7% /boot
[shiratsu@localhost ~]$
ちなみにDockerfileはこちらです(編集しました。以下はうまくいった、Dockerfileです)
[shiratsu@localhost ~]$ cat docker/Dockerfile
# SSH-DOCKER
#
# VERSION 1
FROM centos:centos6
MAINTAINER shiratsu
RUN yum -y update
#Dev tools for all Docker
RUN yum -y install git vim
RUN yum -y install passwd openssh openssh-server openssh-clients sudo
# create user
RUN useradd shiratsu
RUN passwd -f -u shiratsu
RUN mkdir -p /home/shiratsu/.ssh;chown shiratsu /home/shiratsu/.ssh; chmod 700 /home/shiratsu/.ssh
ADD ./authorized_keys /home/shiratsu/.ssh/authorized_keys
RUN chown shiratsu /home/shiratsu/.ssh/authorized_keys;chmod 600 /home/shiratsu/.ssh/authorized_keys
# setup sudoers
RUN echo "shiratsu ALL=(ALL) ALL" >> /etc/sudoers.d/shiratsu
# setup sshd
ADD ./sshd_config /etc/ssh/sshd_config
RUN /etc/init.d/sshd start;/etc/init.d/sshd stop
# expose for sshd
EXPOSE 2222
CMD ["/usr/sbin/sshd","-D"]
vagrant内のcentosとdockerのバージョン追記します
[shiratsu@localhost ~]$ sudo docker version
Client version: 1.3.2
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 39fa2fa/1.3.2
OS/Arch (client): linux/amd64
Server version: 1.3.2
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 39fa2fa/1.3.2
[shiratsu@localhost ~]$ cat /etc/redhat-release
CentOS release 6.4 (Final)
以下の形で終わってます
[shiratsu@localhost docker]$ sudo docker build -t "shiratsu/docker_sshd" .
Step 3 : RUN yum -y install git vim
---> Running in 83559dba7226
省略
Complete!
2015/01/27 05:26:50 Unknown filesystem type on /dev/mapper/docker-253:0- 17040527-5acf57c684f52d4890db5239ca86fd39fc91f2804f4f38d75f526570b7517e42
最小限に一旦変更
[shiratsu@localhost docker]$ sudo docker build -t "shiratsu/docker_sshd" .
Sending build context to Docker daemon 6.656 kB
Sending build context to Docker daemon
Step 0 : FROM busybox
Pulling repository busybox
4986bf8c1536: Download complete
511136ea3c5a: Download complete
df7546f9f060: Download complete
ea13149945cb: Download complete
Status: Downloaded newer image for busybox:latest
---> 4986bf8c1536
Step 1 : RUN echo hello world
---> Running in 59bd215b5aee
hello world
---> 9eb80f3639b9
Removing intermediate container 59bd215b5aee
Successfully built 9eb80f3639b9
[shiratsu@localhost docker]$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
shiratsu/docker_sshd latest 9eb80f3639b9 About a minute ago 2.433 MB
busybox buildroot-2014.02 4986bf8c1536 3 weeks ago 2.433 MB
busybox latest 4986bf8c1536 3 weeks ago 2.433 MB
作ったのち、Dockerのコンテナに対してSSHできることを確認した。
[shiratsu@localhost ~]$ ssh -p 2222 -i ~/.ssh/id_rsa shiratsu@172.17.0.11
Enter passphrase for key '/home/shiratsu/.ssh/id_rsa':
Last login: Wed Jan 28 02:31:40 2015 from 172.17.42.1
[shiratsu@b4ec26bb342c ~]$
最後にローカルMacから接続できるか確認!
{15-01-28 11:54}[ruby-2.1.0]server:~@master✗✗✗✗✗✗ shiratsu% ssh -v -o ProxyCommand='nc -x 192.168.33.10 %h %p' -p 2222 -i /Users/shiratsu/.ssh/id_rsa 172.17.0.11
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/shiratsu/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug1: Executing proxy command: exec nc -x 192.168.33.10 172.17.0.11 2222
debug1: permanently_drop_suid: 501
debug1: identity file /Users/shiratsu/.ssh/id_rsa type 1
debug1: identity file /Users/shiratsu/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
ssh_exchange_identification: Connection closed by remote host
docker側のhosts.allow,hosts.denyに何も設定はなかったです
他になにかこのSSHできない問題に何か回答ありますでしょうか
よろしくお願いします。