Bulding CentOS 8 with SSHD Docker Image

Using this repo files we can build CentOS 8 with SSHD image, Dockerfiles. This repo also included docker-compose file we can start the continer with SSH port 2222 on the host.

  • Create the SSH key to loin the container using public key authentication.
ssh-keygen -N ''  -t ed25519 -f ~/.ssh/id_ed25519 -C "Secure Key"
  • Copy public key into authorized_keys file.
cp ~/.ssh/id_ed25519.pub ~/.ssh/authorized_keys
  • Start the docker container
docker-compose up
  • Open another window and get the Host IP address, and login to docker container.
ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$IP -p 2222

Copyright © 2004, Software Groups