Docker

Docker initialization
In order to open a new docker use the following command:

For Permuter1: sudo docker run -it --gpus all --mount type=bind,source=/common_space/,target=/common_space_docker/ -p 7777:22 --name DOCKER_NAME gcr.io/tensorflow/tensorflow:latest-gpu-py3 bash For Permuter2: sudo nvidia-docker run -it --gpus all --mount type=bind,source=/storage/,target=/common_space_docker/ -p 7777:22 --name DOCKER_NAME --runtime=nvidia tensorflow/tensorflow:latest-gpu-py3 bash For Permuter3: sudo nvidia-docker run --gpus all -it --mount type=bind,source=/storage/,target=/common_space_docker/ -p 7777:22  --name DOCKER_NAME tensorflow/tensorflow:latest-gpu-py3  bash

Options:
 * bind maps a directory in the server to a directory in the docker. Hence in "source=XXXX" put a new directory for your docker. e.g. "/common_space/new_docker_env". The "target" attribute of mount should not be changed.
 * p maps ports of the server and the docker. For instance "-p 7777:22" maps the port 7777 of the server to port 22 of the docker.
 * name here choose the name of the new docker.

Arguments:
 * docker image path to docker image. e.g "gcr.io/tensorflow/tensorflow:latest-gpu-py3".
 * command to run in the new opened docker. e.g "bash".

Docker restart
In order to reopen a closed docker use the following command docker restart DOCKER_NAME Note that once the docker is restarted, the ssh-server activation should be done again

ssh-server initialization
Initiate bash shell of the docker: docker exec -it DOCKER_NAME bash

Enable the ssh command, run the following command inside the docker container. apt update && apt install -y openssh-server mkdir /var/run/sshd echo 'root:123456' | chpasswd

The last command changes root password to 123456. sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config sed -i 's+Subsystem     sftp    /usr/.*+Subsystem sftp internal-sftp+' /etc/ssh/sshd_config sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd echo "export VISIBLE=now" >> /etc/profile service ssh restart

packages installation
apt-get update apt install vim pip install --upgrade pip pip install --upgrade tflearn matplotlib keras torch torchvision scikit-learn scipy tqdm

View existing docker containers
In order to view all existing docker containers run the following command: docker ps -a

Open a shell of a docker
In order to open a new shell of an existing docker, run this command in the server: docker exec -it DOCKER_NAME bash

Using the SSH to run the docker
ssh -p  root@ for example: ssh -p 1234 root@132.72.12.34