Thanks to visit codestin.com
Credit goes to github.com

Skip to content

atomiechen/handy-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Handy Docker

Images, Tags and Dockerfiles

Following images are integrated with OpenSSH server / client for remote development. They are built with UID=1000 and GID=1000 to create the non-root user.

(Deprecated Images)
  • python-ssh-node (Docker Hub): Python + Node integrated with SSH.
  • pytorch-tzdata-ssh (Docker Hub): PyTorch integrated with SSH and tzdata.

How to Use These Images

You can run the container with the following command, where SALTED_PASSWD is the salted password for the SSH user:

docker run --name my_ssh_container -e SALTED_PASSWD=my_salted_password -d atomie/python-ssh:3.10

But usually you want to mount the host's directory and need to make the user ID and group ID consistent between the host and the container to avoid permission issues. You can run the container with environment variables USER_ID and GROUP_ID:

docker run -d \
  --name my_ssh_container \
  -e SALTED_PASSWD=my_salted_password \
  -e USER_ID=$(id -u) \
  -e GROUP_ID=$(id -g) \
  -v /path/to/host/dir:/path/to/container/dir \
  atomie/python-ssh:3.10

Generate Salted Password

Note

You can use gen_salted_passwd.sh to generate the salted password file interactively.

The encrypted password is generated with salt:

CLEAR_PASSWD="clear_text_password"
SALTED_PASSWD=$(printf $CLEAR_PASSWD | openssl passwd -6 -salt KdN5Re3X2X18 -stdin)
echo $SALTED_PASSWD > salted_passwd

Docker Secrets

As an alternative to passing the salted password as an environment variable, you can use Docker secrets to store the salted password in a file and mount it to the container.

docker secret create salted_passwd salted_passwd

Then you can run the container by specifying the secret file path to the environment variable SALTED_PASSWD_FILE:

docker run -d \
  --name my_ssh_container \
  --secret salted_passwd \
  -e SALTED_PASSWD_FILE=/run/secrets/salted_passwd \
  atomie/python-ssh:3.10

Handy scripts

Scripts in scripts directory:

  • start_docker.sh: script for (re)starting a container with SSH-integration.
  • start_super_docker.sh: script for further sharing the host's docker socket and binary with the container.
  • gen_salted_passwd.sh: interactive script for generating the salted password to a file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages