This container provides the most recent official Python container with SSH server preinstalled.
This starts the container while listening for SSH connections on port 2222:
docker run -d -v '/mnt/pythonssh':'/config':'rw' -p '2222:22/tcp' '<work-in-progress>'Note: The SSH username and password is randomly created and visible through the container logs (only on initial setup).
After the initial setup the /config directory (/mnt/pythonssh on your host machine) contains two files:
username.confcontaining the usernamepassword_hash.confcontaining the password hash
This starts the container while setting username, password hash, user id and group id:
docker run -d --name='pythonssh' -e USERNAME='pythonssh' -e PUID='99' -e PGID='100' -e PASSWORD_HASH='<password_hash>' -v '/mnt/pythonssh':'/config':'rw' -p '2222:22/tcp' '<work-in-progress>'You could create the hash with the following command on your local machine:
openssl passwd -6 your_password_in_clear_textOr you could add -e PASSWORD='your_password_in_clear_text' to your docker run command, run the container once and remove it again, as further runs will use the hash in /config/password_hash.conf as mentioned above.
As /config is the home directory of USERNAME, you can provide /config/.ssh/authorized_keys to connect by key instead of password.
- Allow to set official Python tags (latest, slim, alpine, etc)