$ telnet localhost 10023
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Kernel 5.4.0-109-generic on an x86_64
telentd login: root
Password:
[root@telentd ~]#
$ docker ps -a# 停止しているコンテナも含めて表示する
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a663e68cffa3 centos-telnetd "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:10023->23/tcp, :::10023->23/tcp telnet-server
$ docker stop telnet-server
$ docker rm a663e68cffa3 # docker rm telnet-serverでも可
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos-telnetd latest fd4dfbbb65ad 33 minutes ago 796MB
$ docker rmi fd4dfbbb65ad # docker rmi centos7-telnetd:latestでも可
$ docker ps -a# 停止しているコンテナも含めて表示する
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
FROM centos:7
RUN yum update -y
RUN yum install -y openssh-server
RUN ssh-keygen -A
RUN echo "root:root" | chpasswd
RUN adduser user
RUN echo "user:user" | chpasswd
CMD ["/usr/sbin/sshd", "-D"]
$ docker build --tag centos7-sshd .
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos7-sshd latest 4b6b1ef383b0 33 seconds ago 673MB
<none><none> 9d2878d51761 About a minute ago 885MB
centos 7 eeb6ee3f44bd 7 months ago 204MB
$ docker run -it--hostname server --name sshd-server -p 10022:22/tcp -d centos7-sshd
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d94cb10cd66f centos7-sshd "/usr/sbin/sshd -D"8 seconds ago Up 7 seconds 0.0.0.0:10022->22/tcp, :::10022->22/tcp sshd-server
$ ssh -p10022 root@localhost
The authenticity of host '[localhost]:10022 ([127.0.0.1]:10022)' can't be established.ECDSA key fingerprint is SHA256:Z3I2gQ3w7wo1MNJ/8fuTBE1Wnd169RR0qgZ5IyhBHpk.Are you sure you want to continue connecting (yes/no/[fingerprint])? yesWarning: Permanently added '[localhost]:10022' (ECDSA) to the list of known hosts.root@localhost's password:
[root@server ~]#
$ ssh -p10022 root@localhost
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:/W9DGeoHg56m1FvGj8UWp9SBJ+ZNcRVhDdVZDI52XaA.
Please contact your system administrator.
Add correct host key in /home/username/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/username/.ssh/known_hosts:1
remove with:
ssh-keygen -f"/home/username/.ssh/known_hosts"-R"[localhost]:10022"
ECDSA host key for[localhost]:10022 has changed and you have requested strict checking.
Host key verification failed.
$ ssh-keygen -R [localhost]:10022
# Host [localhost]:10022 found: line 1
/home/username/.ssh/known_hosts updated.
$ ssh -p 10022 root@localhost
The authenticity of host '[localhost]:10022 ([127.0.0.1]:10022)' can't be established.
ECDSA key fingerprint is SHA256:/W9DGeoHg56m1FvGj8UWp9SBJ+ZNcRVhDdVZDI52XaA.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:10022' (ECDSA) to the list of known hosts.
root@localhost's password:
[root@server ~]#
docker hubの上記の記載のもう少し下にdocker-compose.ymlで渡せる環境変数の一覧(Environment variables summary)が書かれており、その中にPMA_HOSTS - define comma separated list of address/host names of the MySQL serversの記載がある。