Common commands

Command to install docker/nvidia-docker on ubuntu (say ubuntu 16.04 xenial in AWS)

# Pre-requisites:
 1. Install docker first by doing:
           sudo su
           curl -fsSL https://get.docker.com/ | sh
     Add 'ubuntu' user to docker group
     sudo usermod -aG docker $USER

# Then do the following
 2. Then cd to the directory where the Dockerfile is kept
 3. Run:
           docker build -t custom-tf-docker-image-inference .

 4. Install nvidia-docker and nvidia-docker-plugin 
    apt install -y nvidia-cuda-toolkit
    apt install -y nvidia-modprobe
    wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb
    dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb

    service nvidia-docker status
    service nvidia-docker start
    nvidia-smi

    # the following command may not be needed
    # apt-get install linux-headers-$(uname -r)

 5. Test nvidia-smi # this command gave driver mismatch error and I could not solve it
    nvidia-docker run --rm nvidia/cuda nvidia-smi

 6. reboot
 7. nvidia-docker run -p 8888:8888 -p 6006:6006 -p 8090:8090 -p 9007:9007 \
                  --name custy-agshift-gpu-inference-new \
                  -it -v /home/ubuntu/tf_files:/tf_files custom-tf-docker-image-inference

 8. cd /
 9. nohup ./run_jupyter.sh --allow-root > tf_files/nohup.out 2>&1 < /dev/null &

  # To stop a jupyter server
   jupyter notebook stop <port_number like 8888 or 8889>

Ref: docker command line:
https://docs.docker.com/engine/reference/commandline/run/#capture-container-id-cidfile
https://github.com/NVIDIA/nvidia-docker
http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

10. To get in to a docker container, without corrupting the display
  docker exec -it f27eed929330 bash -c "export COLUMNS=`tput cols`; export LINES=`tput lines`; exec bash"

Commands on docker images

Difference between EXPOSE and PUBLISH (ports)

https://stackoverflow.com/questions/22111060/difference-between-expose-and-publish-in-docker

Commands on docker containers

Communicating between docker containers

Ref: https://docs.oracle.com/cd/E37670_01/E75728/html/section_rsr_p2z_fp.html

Ref: https://docs.docker.com/engine/userguide/networking/

Command to launch docker using nvidia-docker wrapper

If GPU stops working for a docker container

Restore cudNN

Commands to launch docker

Commands to investigate nvidia gpu and docker

Ref: https://github.com/floydhub/dl-setup#nvidia-drivers

Ref: https://github.com/NVIDIA/nvidia-docker

Mounting s3 in ec2 instance

Ref: https://cloudkul.com/blog/mounting-s3-bucket-linux-ec2-instance/

Mounting s3 in docker

This is tricky.

Ref: https://github.com/xueshanf/docker-s3fs

Command to launch tensorboard:

DOCKER SETUP - UBUNTU

DOCKER NETWORKING - Running a simple client server (sockets) between 2 dockers

Ref: https://forums.docker.com/t/running-a-simple-client-server-program-in-docker/7321/2

Last updated

Was this helpful?