Skip to content

publiusys/docker-env-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

docker-env-examples

Example docker files to create a container with remote SSH, isolated environment for install external packages

Example Commands

# first build the docker image, this automatically looks for Dockerfile in existing folder
$ docker build -t nvidia-ssh-image .

$ docker images
REPOSITORY         TAG       IMAGE ID       CREATED         SIZE
nvidia-ssh-image   latest    629f9eebcbbf   6 seconds ago   6.73GB

# this creates a new container from the nvidia-ssh-image with port forwarding to 2001 for remote SSH, custom hostname, custom username, and mounts /tmp/authorized_keys for remote SSH key access
$ sudo docker run -d -p 2001:22 --hostname dgx1-docker -e USERNAME=hdong1 -v /tmp/authorized_keys:/tmp/authorized_keys:ro --name hdong1-container --gpus=all nvidia-ssh-image

# assuming the IP address of the node where the container is running is 192.168.1.2, then to SSH to the container
# this assumes you have ssh-agent setup to authenticate keys
$ ssh hdong1@192.168.1.2 -p 2001

Helpful docker commands

docker run --help
docker images
docker ps --all

docker rm -f b0675c6ee815 # to remove specific container
docker rmi nvidia-ssh-image:latest # remove docker image

docker ps
docker logs 62915c62e05d

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published