Created | Updated | Maintainer |
---|---|---|
2024-07-27 14:01:27 +0530 |
2024-07-31 16:28:10 +0530 |
Ibrar Ansari |
π¨ Please note: This image is designed for educational and testing purposes π π§ͺ ONLY! It is NOT SUITABLE for production environments! π«
This Docker image is built on Ubuntu 22.04 and comes pre-installed with an SSH server, enabling seamless creation of SSH-accessible containers. You can effortlessly configure access using SSH keys or by utilizing a default username and password.
ssh-keygen -t rsa -f ~/.ssh/ansible_id_rsa_key -b 4096 -C "This is used for ansible" -N ""
ls -alsh ~/.ssh/
docker pull ibraransaridocker/ubuntu-ssh-enabled:latest
container_name=server_1
ssh_user=ibrar_ansari
ssh_pass=your_secure_password
ssh_port=2023
container_image=ibraransaridocker/ubuntu-ssh-enabled:latest
key_path=~/.ssh/ansible_id_rsa_key.pub
docker run -itd --name=$container_name -p $ssh_port:22 -e SSH_USERNAME=$ssh_user -e PASSWORD=$ssh_pass -e AUTHORIZED_KEYS="$(cat $key_path)" $container_image
hostname=$(hostname -I | awk '{print $1}')
ssh -i ~/.ssh/ansible_id_rsa_key -p $ssh_port $ssh_user@$hostname
ssh -p $ssh_port $ssh_user@$hostname