Difference between revisions of "Docker"

From Interaction Station Wiki
Jump to navigation Jump to search
(Docker)
Line 1: Line 1:
 
ML Docker Image installed on the Interaction Station ML computers:<br/>
 
ML Docker Image installed on the Interaction Station ML computers:<br/>
 +
 +
=Installing Docker CE on Ubuntu 16.04:=
 +
*sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
 +
*curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
 +
*sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
 +
*sudo apt-get update
 +
 +
*More info: https://unix.stackexchange.com/questions/363048/unable-to-locate-package-docker-ce-on-a-64bit-ubuntu
 +
 +
==Change Docker root dir using systemd==
 +
*systemctl status docker.service
 +
*sudo nano /etc/default/docker
 +
*Edit ExecStart line to look like this ExecStart =/usr/bin/dockerd -g /media/MachineLearning/docker -H fd://
 +
*systemctl daemon-reload
 +
*systemctl restart docker
 +
*sudo docker info - verify the root dir has updated
 +
*https://github.com/IronicBadger/til/blob/master/docker/change-docker-root.md
 +
 +
==Docker - clean up all the volumes==
 +
*sudo docker system prune -a -f --volumes
 +
  
 
=Deepo=
 
=Deepo=
Line 16: Line 37:
 
*caffe2
 
*caffe2
 
*torch
 
*torch
 +
 +
 +
==Installing Deepo:==
 +
*[http://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/340.107/NVIDIA-Linux-x86_64-340.107.run&lang=us&type=TITAN Prerequisite 1: Nvidia driver ]
 +
*[https://github.com/NVIDIA/nvidia-docker Prerequisite 2: nvidia-docker]
 +
*[https://github.com/ufoym/deepo Deepo (for GPU)]
  
 
==Run Deepo image with Docker:==
 
==Run Deepo image with Docker:==
Line 23: Line 50:
 
*sudo nvidia-docker run -it ufoym/deepo:py27 bash
 
*sudo nvidia-docker run -it ufoym/deepo:py27 bash
  
'''Setting up ML computers:'''
+
=Setting up ML computers:=
 
*Linux distribution installed: Ubuntu 16.04
 
*Linux distribution installed: Ubuntu 16.04
  
'''Partition made for machine learning:MachineLearning'''
+
==Partition made for machine learning:MachineLearning==
 
*In Windows: Disk Management -> Resize DataStorage
 
*In Windows: Disk Management -> Resize DataStorage
 
*Create new ext4 patition
 
*Create new ext4 patition
  
'''Mounting the partition automatically:'''
+
==Mounting the partition automatically:==
  
*'''Get the UUID of the learning:MachineLearning partition'''
+
===Get the UUID of the learning:MachineLearning partition===
 
*sudo blkid
 
*sudo blkid
  
*'''Add partition to fstab:'''
+
===Add partition to fstab:===
 
*sudo nano /etc/fstab
 
*sudo nano /etc/fstab
 
*Add at the bottom these two lines:
 
*Add at the bottom these two lines:
Line 45: Line 72:
 
*https://askubuntu.com/questions/678857/fstab-doesnt-mount-with-exec
 
*https://askubuntu.com/questions/678857/fstab-doesnt-mount-with-exec
  
'''Give writing permissions to new MachineLearning partition'''
+
===Give writing permissions to new MachineLearning partition===
 
*sudo chmod -R a+rwx /media/MachineLearning/
 
*sudo chmod -R a+rwx /media/MachineLearning/
  
Line 51: Line 78:
 
https://askubuntu.com/questions/492054/how-to-extend-my-root-partition
 
https://askubuntu.com/questions/492054/how-to-extend-my-root-partition
  
'''Installing NVIDIA Driver:'''
+
==Installing NVIDIA Driver:==
 
*Set Ubuntu to boot on console mode. Type:
 
*Set Ubuntu to boot on console mode. Type:
 
*sudo apt-get install systemd
 
*sudo apt-get install systemd
Line 65: Line 92:
 
*sudo systemctl set-default graphical.target
 
*sudo systemctl set-default graphical.target
 
*sudo reboot now
 
*sudo reboot now
 
  
 
'''Checking if Nvidia Driver is properly installed. Type:'''
 
'''Checking if Nvidia Driver is properly installed. Type:'''
Line 71: Line 97:
 
*nvidia-settings
 
*nvidia-settings
  
'''Installing CUDA 9.0 for Ubuntu 16.04 (the latest version is not supported by TensorFlow):'''
+
==Installing CUDA 9.0 for Ubuntu 16.04 (the latest version is not supported by TensorFlow):==
 
*wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
 
*wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
 
*wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
 
*wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
Line 100: Line 126:
 
*https://yangcha.github.io/CUDA90/
 
*https://yangcha.github.io/CUDA90/
  
'''Installing Docker CE on Ubuntu 16.04:'''
 
*sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
 
*curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
 
*sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
 
*sudo apt-get update
 
 
*More info: https://unix.stackexchange.com/questions/363048/unable-to-locate-package-docker-ce-on-a-64bit-ubuntu
 
 
'''Installing Deepo:'''
 
*[http://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/340.107/NVIDIA-Linux-x86_64-340.107.run&lang=us&type=TITAN Prerequisite 1: Nvidia driver ]
 
*[https://github.com/NVIDIA/nvidia-docker Prerequisite 2: nvidia-docker]
 
*[https://github.com/ufoym/deepo Deepo (for GPU)]
 
 
 
 
 
 
 
'''Change Docker root dir using systemd'''
 
*systemctl status docker.service
 
*sudo nano /etc/default/docker
 
*Edit ExecStart line to look like this ExecStart =/usr/bin/dockerd -g /media/MachineLearning/docker -H fd://
 
*systemctl daemon-reload
 
*systemctl restart docker
 
*sudo docker info - verify the root dir has updated
 
*https://github.com/IronicBadger/til/blob/master/docker/change-docker-root.md
 
 
'''Docker - clean up all the volumes'''
 
*sudo docker system prune -a -f --volumes
 
  
 
'''Other options:'''
 
'''Other options:'''

Revision as of 05:23, 12 October 2018

ML Docker Image installed on the Interaction Station ML computers:

Installing Docker CE on Ubuntu 16.04:

Change Docker root dir using systemd

Docker - clean up all the volumes

  • sudo docker system prune -a -f --volumes


Deepo

It includes:

  • cudnn
  • theano
  • tensorflow
  • sonnet
  • pytorch
  • keras
  • lasagne
  • mxnet
  • cntk
  • chainer
  • caffe
  • caffe2
  • torch


Installing Deepo:

Run Deepo image with Docker:

  • sudo nvidia-docker run -it ufoym/deepo:gpu bash

Run Deepo image with Docker (with python 2.7):

  • sudo nvidia-docker run -it ufoym/deepo:py27 bash

Setting up ML computers:

  • Linux distribution installed: Ubuntu 16.04

Partition made for machine learning:MachineLearning

  • In Windows: Disk Management -> Resize DataStorage
  • Create new ext4 patition

Mounting the partition automatically:

Get the UUID of the learning:MachineLearning partition

  • sudo blkid

Add partition to fstab:

  • sudo nano /etc/fstab
  • Add at the bottom these two lines:
  • UUID=(id of the MachineLearning partition) /media/MachineLearning rw,suid,dev,auto,user,async,exec 0 2
  • UUID=(id of the DataStorage partition) /media/DataStorage ntfs-3g defaults=en_US.UTF-8 0 0

Give writing permissions to new MachineLearning partition

  • sudo chmod -R a+rwx /media/MachineLearning/
  • Need extra space? Extending the partition

https://askubuntu.com/questions/492054/how-to-extend-my-root-partition

Installing NVIDIA Driver:

  • Set Ubuntu to boot on console mode. Type:
  • sudo apt-get install systemd
  • sudo systemctl set-default multi-user.target
  • sudo reboot now
  • Login and in console mode, type:
  • sudo add-apt-repository ppa:graphics-drivers/ppa
  • sudo apt update
  • sudo apt upgrade
  • For GeForce 1070Ti (07/2018), type:
  • sudo apt-get install nvidia-390
  • Re-set Ubuntu to boot on graphical mode. Type:
  • sudo systemctl set-default graphical.target
  • sudo reboot now

Checking if Nvidia Driver is properly installed. Type:

  • nvidia-smi
  • nvidia-settings

Installing CUDA 9.0 for Ubuntu 16.04 (the latest version is not supported by TensorFlow):

Checking if CUDA is properly installed. Type:

  • nvcc --version

Resources used:


Other options:

NTFS fstab wizard:

  • sudo apt-get install ntfs-config
  • sudo ntfs-config

Format large capacity HD with fs ExFat for having access to it from Ubuntu:

  • On Windows 10
  • cmd
  • diskpart
  • select disk '#' (where # is the number of the target drive)
  • list part
  • select part # (where # is the number of the partition)
  • format fs=exfat QUICK