Uses a public SSH key for authentication. Build a new image with a new public key named id_rsa.pub in directory named "files" in the same location as the Dockerfile to have the key copied to the container's authorized_keys store.
Run container in a CentOS 7 host with:
$ docker run -ti -d -P --privileged --name test_sshd -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /tmp/$(mktemp -d):/run ravik694/c7-systemd-sshd_key
Locate the container's IP address with:
$ docker inspect test_sshd | grep '"IPAddress":'
Connect to the container with SSH from the host:
$ ssh root@<ip_address>
[root@4b162f189534 ~]#
Content type
Image
Digest
Size
73.3 MB
Last updated
over 10 years ago
docker pull ravik694/c7-systemd-sshd_key