{"id":1678,"date":"2017-07-24T14:00:25","date_gmt":"2017-07-24T12:00:25","guid":{"rendered":"https:\/\/www.nico-maas.de\/?p=1678"},"modified":"2017-07-24T11:03:36","modified_gmt":"2017-07-24T09:03:36","slug":"cuda-and-tensorflow-in-docker","status":"publish","type":"post","link":"https:\/\/www.nico-maas.de\/?p=1678","title":{"rendered":"CUDA and Tensorflow in Docker"},"content":{"rendered":"<p>In this howto we will get CUDA working in Docker. And - as bonus - add Tensorflow on top! However, please note that you'll need following prereqs:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">GNU\/Linux x86_64 with kernel version &gt; 3.10\nDocker &gt;= 1.9 (official docker-engine, docker-ce or docker-ee only)\nNVIDIA GPU with Architecture &gt; Fermi (2.1)\nNVIDIA drivers &gt;= 340.29 with binary nvidia-modprobe<\/pre>\n<p>We will install the NVIDIA drivers in this tutorial, so you should only have the right kernel and docker version already installed, we're using a Ubuntu 15.05 x64 machine here. For CUDA, you'll need a Fermi 2.1 CUDA card (or better), for tensorflow a &gt;= 3.0 CUDA card...<\/p>\n<h5>Which Graphicscard Model do I own?<\/h5>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">lspci | grep VGA\nsudo lshw -C video<\/pre>\n<p>Output i.e.:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">product: GF108 [GeForce GT 430]\nvendor: NVIDIA Corporation<\/pre>\n<p>You should lookup on google if it works with cuda \/ Fermi 2.1, i.e. on <a href=\"https:\/\/developer.nvidia.com\/cuda-gpus\">https:\/\/developer.nvidia.com\/cuda-gpus<\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">GeForce GT 430 - Compute: 2.1<\/pre>\n<p>Ok, that one works!<\/p>\n<p>I got additional infos from: <a href=\"https:\/\/www.geforce.com\/hardware\/desktop-gpus\/geforce-gt-430\/specifications\">https:\/\/www.geforce.com\/hardware\/desktop-gpus\/geforce-gt-430\/specifications<\/a><\/p>\n<h5>CUDA and Docker?<\/h5>\n<p>You can find out more about that topic on\u00a0<a href=\"https:\/\/github.com\/NVIDIA\/nvidia-docker\">https:\/\/github.com\/NVIDIA\/nvidia-docker<\/a><\/p>\n<p>Getting it to work will be the next step:<\/p>\n<h6>Download right CUDA \/ NVIDIA Driver<\/h6>\n<p>from <a href=\"http:\/\/www.nvidia.com\/object\/unix.html\">http:\/\/www.nvidia.com\/object\/unix.html<\/a><br \/>\nI choose Linux x86_64\/AMD64\/EM64T, Latest Long Lived Branch version: 375.66,\u00a0but please check in the description of the file, if your graphics card is supported!<\/p>\n<h6>After Download, install the driver:<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">chmod +x NVIDIA-Linux-x86_64-375.66.run\nsudo .\/NVIDIA-Linux-x86_64-375.66.run<\/pre>\n<p>It will ask for permission, accept it. If it gives info that the nouveau driver needs to be disabled, just accept that, in the next step, it will generate a blacklist file and exit the setup. Afterwards, run<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">sudo update-initramfs -u<\/pre>\n<p>and reboot your server. Then, rerun the setup with<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">sudo .\/NVIDIA-Linux-x86_64-375.66.run<\/pre>\n<p>You can check the installation with<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">nvidia-smi<\/pre>\n<p>and get an output similar to this one:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Mon Jul 24 09:03:47 2017\n+-----------------------------------------------------------------------------+\n| NVIDIA-SMI 375.66                 Driver Version: 375.66                    |\n|-------------------------------+----------------------+----------------------+\n| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n| Fan  Temp  Perf  Pwr:Usage\/Cap|         Memory-Usage | GPU-Util  Compute M. |\n|===============================+======================+======================|\n|   0  GeForce GT 430      Off  | 0000:01:00.0     N\/A |                  N\/A |\n| N\/A   40C    P0    N\/A \/  N\/A |      0MiB \/   963MiB |     N\/A      Default |\n+-------------------------------+----------------------+----------------------+\n\n+-----------------------------------------------------------------------------+\n| Processes:                                                       GPU Memory |\n|  GPU       PID  Type  Process name                               Usage      |\n|=============================================================================|\n|    0                  Not Supported                                         |\n+-----------------------------------------------------------------------------+<\/pre>\n<p>which means\u00a0that it worked!<\/p>\n<h6>Install nvidia-docker and nvidia-docker-plugin<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">wget -P \/tmp https:\/\/github.com\/NVIDIA\/nvidia-docker\/releases\/download\/v1.0.1\/nvidia-docker_1.0.1-1_amd64.deb\nsudo dpkg -i \/tmp\/nvidia-docker*.deb &amp;&amp; rm \/tmp\/nvidia-docker*.deb<\/pre>\n<h6>Test nvidia-smi from Docker<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">nvidia-docker run --rm nvidia\/cuda nvidia-smi<\/pre>\n<p>should output:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Using default tag: latest\nlatest: Pulling from nvidia\/cuda\ne0a742c2abfd: Pull complete\n486cb8339a27: Pull complete\ndc6f0d824617: Pull complete\n4f7a5649a30e: Pull complete\n672363445ad2: Pull complete\nba1240a1e18b: Pull complete\ne875cd2ab63c: Pull complete\ne87b2e3b4b38: Pull complete\n17f7df84dc83: Pull complete\n6c05bfef6324: Pull complete\nDigest: sha256:c8c492ec656ecd4472891cd01d61ed3628d195459d967f833d83ffc3770a9d80\nStatus: Downloaded newer image for nvidia\/cuda:latest\nMon Jul 24 07:07:12 2017\n+-----------------------------------------------------------------------------+\n| NVIDIA-SMI 375.66                 Driver Version: 375.66                    |\n|-------------------------------+----------------------+----------------------+\n| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n| Fan  Temp  Perf  Pwr:Usage\/Cap|         Memory-Usage | GPU-Util  Compute M. |\n|===============================+======================+======================|\n|   0  GeForce GT 430      Off  | 0000:01:00.0     N\/A |                  N\/A |\n| N\/A   40C    P8    N\/A \/  N\/A |      0MiB \/   963MiB |     N\/A      Default |\n+-------------------------------+----------------------+----------------------+\n\n+-----------------------------------------------------------------------------+\n| Processes:                                                       GPU Memory |\n|  GPU       PID  Type  Process name                               Usage      |\n|=============================================================================|\n|    0                  Not Supported                                         |\n+-----------------------------------------------------------------------------+<\/pre>\n<p>Yep, you got it working in Docker!<\/p>\n<h6>Running an interactive CUDA session isolating the first GPU<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">NV_GPU=0 nvidia-docker run -ti --rm nvidia\/cuda<\/pre>\n<h6>Input our first Hello World program<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">echo '#include &lt;stdio.h&gt;\n\/\/ Kernel-execution with __global__: empty function at this point\n__global__ void kernel(void) {\n\/\/ printf(\"Hello, Cuda!\\n\");\n}\nint main(void) {\n\/\/ Kernel execution with &lt;&lt;&lt;1,1&gt;&gt;&gt;\nkernel&lt;&lt;&lt;1,1&gt;&gt;&gt;();\nprintf(\"Hello, World!\\n\");\nreturn 0;\n}' &gt; helloWorld.cu<\/pre>\n<h6>Compile it within the Docker container<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">nvcc helloWorld.cu -o helloWorld<\/pre>\n<h6>Execute it...<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">.\/helloWorld<\/pre>\n<h6>and you get,...<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Hello, World!<\/pre>\n<p>Congrats, you got it working!<\/p>\n<h5>Encore, Tensorflow<\/h5>\n<h6>Getting Tensorflow to work is straight forward:<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">nvidia-docker run -it -p 8888:8888 tensorflow\/tensorflow:latest-gpu<\/pre>\n<p>It will output something like:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Copy\/paste this URL into your browser when you connect for the first time, to login with a token:\nhttp:\/\/localhost:8888\/?token=d747247b33023883c1a929bc97d9a115e8b2dd0db9437620<\/pre>\n<p>you should do that \ud83d\ude42<\/p>\n<p>Then enter the 1_hello_tensorflow notebook and run the first sample:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">from __future__ import print_function\nimport tensorflow as tf\nwith tf.Session():\n    input1 = tf.constant([1.0, 1.0, 1.0, 1.0])\n    input2 = tf.constant([2.0, 2.0, 2.0, 2.0])\n    output = tf.add(input1, input2)\n    result = output.eval()\n    print(\"result: \", result)<\/pre>\n<p>by selecting it and clicking on the &gt;| (run cell, select below) Button.<br \/>\nThis worked for me:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">result: [ 3. 3. 3. 3.]<\/pre>\n<p>however... sadly not the GPU was calculating the results as shown by the Docker CLI:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Kernel started: 2bc4c3b0-61f3-4ec8-b95b-88ed06379d85\n[I 07:31:45.544 NotebookApp] Adapting to protocol v5.1 for kernel 2bc4c3b0-61f3-4ec8-b95b-88ed06379d85\n2017-07-24 07:32:17.780122: W tensorflow\/core\/platform\/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.\n2017-07-24 07:32:17.837112: I tensorflow\/stream_executor\/cuda\/cuda_gpu_executor.cc:893] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n2017-07-24 07:32:17.837440: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:940] Found device 0 with properties:\nname: GeForce GT 430\nmajor: 2 minor: 1 memoryClockRate (GHz) 1.4\npciBusID 0000:01:00.0\nTotal memory: 963.19MiB\nFree memory: 954.56MiB\n2017-07-24 07:32:17.837498: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:961] DMA: 0\n2017-07-24 07:32:17.837522: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:971] 0:   Y\n2017-07-24 07:32:17.837549: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:1003] Ignoring visible gpu device (device: 0, name: GeForce GT 430, pci bus id: 0000:01:00.0) with Cuda compute capability 2.1. The minimum required Cuda capability is 3.0.<\/pre>\n<p>So, CUDA &gt;= 3.0 devices only for tensorflow \ud83d\ude41 - but, it still works, as it is using the CPU (however, not as fast as it could :\/)<\/p>\n<h6>Infos taken from:<\/h6>\n<p>https:\/\/github.com\/NVIDIA\/nvidia-docker<br \/>\nhttps:\/\/developer.nvidia.com\/cuda-gpus<br \/>\nhttps:\/\/hub.docker.com\/r\/tensorflow\/tensorflow\/<\/p>\n<div class=\"shariff shariff-align-left shariff-widget-align-left\"><ul class=\"shariff-buttons theme-round orientation-horizontal buttonsize-small\"><li class=\"shariff-button printer shariff-nocustomcolor\" style=\"background-color:#a8a8a8\"><a href=\"javascript:window.print()\" title=\"print\" aria-label=\"print\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#999; color:#fff\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 30 32\"><path fill=\"#999\" d=\"M6.8 27.4h16v-4.6h-16v4.6zM6.8 16h16v-6.8h-2.8q-0.7 0-1.2-0.5t-0.5-1.2v-2.8h-11.4v11.4zM27.4 17.2q0-0.5-0.3-0.8t-0.8-0.4-0.8 0.4-0.3 0.8 0.3 0.8 0.8 0.3 0.8-0.3 0.3-0.8zM29.7 17.2v7.4q0 0.2-0.2 0.4t-0.4 0.2h-4v2.8q0 0.7-0.5 1.2t-1.2 0.5h-17.2q-0.7 0-1.2-0.5t-0.5-1.2v-2.8h-4q-0.2 0-0.4-0.2t-0.2-0.4v-7.4q0-1.4 1-2.4t2.4-1h1.2v-9.7q0-0.7 0.5-1.2t1.2-0.5h12q0.7 0 1.6 0.4t1.3 0.8l2.7 2.7q0.5 0.5 0.9 1.4t0.4 1.6v4.6h1.1q1.4 0 2.4 1t1 2.4z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button mailto shariff-nocustomcolor\" style=\"background-color:#a8a8a8\"><a href=\"mailto:?body=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678&subject=CUDA%20and%20Tensorflow%20in%20Docker\" title=\"Send by email\" aria-label=\"Send by email\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#999; color:#fff\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#999\" d=\"M32 12.7v14.2q0 1.2-0.8 2t-2 0.9h-26.3q-1.2 0-2-0.9t-0.8-2v-14.2q0.8 0.9 1.8 1.6 6.5 4.4 8.9 6.1 1 0.8 1.6 1.2t1.7 0.9 2 0.4h0.1q0.9 0 2-0.4t1.7-0.9 1.6-1.2q3-2.2 8.9-6.1 1-0.7 1.8-1.6zM32 7.4q0 1.4-0.9 2.7t-2.2 2.2q-6.7 4.7-8.4 5.8-0.2 0.1-0.7 0.5t-1 0.7-0.9 0.6-1.1 0.5-0.9 0.2h-0.1q-0.4 0-0.9-0.2t-1.1-0.5-0.9-0.6-1-0.7-0.7-0.5q-1.6-1.1-4.7-3.2t-3.6-2.6q-1.1-0.7-2.1-2t-1-2.5q0-1.4 0.7-2.3t2.1-0.9h26.3q1.2 0 2 0.8t0.9 2z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button twitter shariff-nocustomcolor\" style=\"background-color:#595959\"><a href=\"https:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678&text=CUDA%20and%20Tensorflow%20in%20Docker\" title=\"Share on X\" aria-label=\"Share on X\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#000; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\"><path fill=\"#000\" d=\"M14.258 10.152L23.176 0h-2.113l-7.747 8.813L7.133 0H0l9.352 13.328L0 23.973h2.113l8.176-9.309 6.531 9.309h7.133zm-2.895 3.293l-.949-1.328L2.875 1.56h3.246l6.086 8.523.945 1.328 7.91 11.078h-3.246zm0 0\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678\" title=\"Share on Facebook\" aria-label=\"Share on Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\"; background-color:#3b5998; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button linkedin shariff-nocustomcolor\" style=\"background-color:#1488bf\"><a href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678\" title=\"Share on LinkedIn\" aria-label=\"Share on LinkedIn\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#0077b5; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 27 32\"><path fill=\"#0077b5\" d=\"M6.2 11.2v17.7h-5.9v-17.7h5.9zM6.6 5.7q0 1.3-0.9 2.2t-2.4 0.9h0q-1.5 0-2.4-0.9t-0.9-2.2 0.9-2.2 2.4-0.9 2.4 0.9 0.9 2.2zM27.4 18.7v10.1h-5.9v-9.5q0-1.9-0.7-2.9t-2.3-1.1q-1.1 0-1.9 0.6t-1.2 1.5q-0.2 0.5-0.2 1.4v9.9h-5.9q0-7.1 0-11.6t0-5.3l0-0.9h5.9v2.6h0q0.4-0.6 0.7-1t1-0.9 1.6-0.8 2-0.3q3 0 4.9 2t1.9 6z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button reddit shariff-nocustomcolor\" style=\"background-color:#ff5700\"><a href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678\" title=\"Share on Reddit\" aria-label=\"Share on Reddit\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#ff4500; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path fill=\"#ff4500\" d=\"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button pinterest shariff-nocustomcolor\" style=\"background-color:#e70f18\"><a href=\"https:\/\/www.pinterest.com\/pin\/create\/link\/?url=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678&media=https%3A%2F%2Fwww.nico-maas.de%2Fwordpress%2Fwp-content%2Fplugins%2Fshariff%2Fimages%2FdefaultHint.png&description=CUDA%20and%20Tensorflow%20in%20Docker\" title=\"Pin it on Pinterest\" aria-label=\"Pin it on Pinterest\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#cb2027; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 27 32\"><path fill=\"#cb2027\" d=\"M27.4 16q0 3.7-1.8 6.9t-5 5-6.9 1.9q-2 0-3.9-0.6 1.1-1.7 1.4-2.9 0.2-0.6 1-3.8 0.4 0.7 1.3 1.2t2 0.5q2.1 0 3.8-1.2t2.7-3.4 0.9-4.8q0-2-1.1-3.8t-3.1-2.9-4.5-1.2q-1.9 0-3.5 0.5t-2.8 1.4-2 2-1.2 2.3-0.4 2.4q0 1.9 0.7 3.3t2.1 2q0.5 0.2 0.7-0.4 0-0.1 0.1-0.5t0.2-0.5q0.1-0.4-0.2-0.8-0.9-1.1-0.9-2.7 0-2.7 1.9-4.6t4.9-2q2.7 0 4.2 1.5t1.5 3.8q0 3-1.2 5.2t-3.1 2.1q-1.1 0-1.7-0.8t-0.4-1.9q0.1-0.6 0.5-1.7t0.5-1.8 0.2-1.4q0-0.9-0.5-1.5t-1.4-0.6q-1.1 0-1.9 1t-0.8 2.6q0 1.3 0.4 2.2l-1.8 7.5q-0.3 1.2-0.2 3.2-3.7-1.6-6-5t-2.3-7.6q0-3.7 1.9-6.9t5-5 6.9-1.9 6.9 1.9 5 5 1.8 6.9z\"\/><\/svg><\/span><\/a><\/li><\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>In this howto we will get CUDA working in Docker. And - as bonus - add Tensorflow on top! However, please note that you'll need following prereqs: GNU\/Linux x86_64 with kernel version &gt; 3.10 Docker &gt;= 1.9 (official docker-engine, docker-ce or docker-ee only) NVIDIA GPU with Architecture &gt; Fermi (2.1) NVIDIA drivers &gt;= 340.29 with &hellip; <a href=\"https:\/\/www.nico-maas.de\/?p=1678\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">CUDA and Tensorflow in Docker<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div class=\"shariff shariff-align-left shariff-widget-align-left\"><ul class=\"shariff-buttons theme-round orientation-horizontal buttonsize-small\"><li class=\"shariff-button printer shariff-nocustomcolor\" style=\"background-color:#a8a8a8\"><a href=\"javascript:window.print()\" title=\"print\" aria-label=\"print\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#999; color:#fff\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 30 32\"><path fill=\"#999\" d=\"M6.8 27.4h16v-4.6h-16v4.6zM6.8 16h16v-6.8h-2.8q-0.7 0-1.2-0.5t-0.5-1.2v-2.8h-11.4v11.4zM27.4 17.2q0-0.5-0.3-0.8t-0.8-0.4-0.8 0.4-0.3 0.8 0.3 0.8 0.8 0.3 0.8-0.3 0.3-0.8zM29.7 17.2v7.4q0 0.2-0.2 0.4t-0.4 0.2h-4v2.8q0 0.7-0.5 1.2t-1.2 0.5h-17.2q-0.7 0-1.2-0.5t-0.5-1.2v-2.8h-4q-0.2 0-0.4-0.2t-0.2-0.4v-7.4q0-1.4 1-2.4t2.4-1h1.2v-9.7q0-0.7 0.5-1.2t1.2-0.5h12q0.7 0 1.6 0.4t1.3 0.8l2.7 2.7q0.5 0.5 0.9 1.4t0.4 1.6v4.6h1.1q1.4 0 2.4 1t1 2.4z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button mailto shariff-nocustomcolor\" style=\"background-color:#a8a8a8\"><a href=\"mailto:?body=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678&subject=CUDA%20and%20Tensorflow%20in%20Docker\" title=\"Send by email\" aria-label=\"Send by email\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#999; color:#fff\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#999\" d=\"M32 12.7v14.2q0 1.2-0.8 2t-2 0.9h-26.3q-1.2 0-2-0.9t-0.8-2v-14.2q0.8 0.9 1.8 1.6 6.5 4.4 8.9 6.1 1 0.8 1.6 1.2t1.7 0.9 2 0.4h0.1q0.9 0 2-0.4t1.7-0.9 1.6-1.2q3-2.2 8.9-6.1 1-0.7 1.8-1.6zM32 7.4q0 1.4-0.9 2.7t-2.2 2.2q-6.7 4.7-8.4 5.8-0.2 0.1-0.7 0.5t-1 0.7-0.9 0.6-1.1 0.5-0.9 0.2h-0.1q-0.4 0-0.9-0.2t-1.1-0.5-0.9-0.6-1-0.7-0.7-0.5q-1.6-1.1-4.7-3.2t-3.6-2.6q-1.1-0.7-2.1-2t-1-2.5q0-1.4 0.7-2.3t2.1-0.9h26.3q1.2 0 2 0.8t0.9 2z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button twitter shariff-nocustomcolor\" style=\"background-color:#595959\"><a href=\"https:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678&text=CUDA%20and%20Tensorflow%20in%20Docker\" title=\"Share on X\" aria-label=\"Share on X\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#000; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\"><path fill=\"#000\" d=\"M14.258 10.152L23.176 0h-2.113l-7.747 8.813L7.133 0H0l9.352 13.328L0 23.973h2.113l8.176-9.309 6.531 9.309h7.133zm-2.895 3.293l-.949-1.328L2.875 1.56h3.246l6.086 8.523.945 1.328 7.91 11.078h-3.246zm0 0\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678\" title=\"Share on Facebook\" aria-label=\"Share on Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\"; background-color:#3b5998; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button linkedin shariff-nocustomcolor\" style=\"background-color:#1488bf\"><a href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678\" title=\"Share on LinkedIn\" aria-label=\"Share on LinkedIn\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#0077b5; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 27 32\"><path fill=\"#0077b5\" d=\"M6.2 11.2v17.7h-5.9v-17.7h5.9zM6.6 5.7q0 1.3-0.9 2.2t-2.4 0.9h0q-1.5 0-2.4-0.9t-0.9-2.2 0.9-2.2 2.4-0.9 2.4 0.9 0.9 2.2zM27.4 18.7v10.1h-5.9v-9.5q0-1.9-0.7-2.9t-2.3-1.1q-1.1 0-1.9 0.6t-1.2 1.5q-0.2 0.5-0.2 1.4v9.9h-5.9q0-7.1 0-11.6t0-5.3l0-0.9h5.9v2.6h0q0.4-0.6 0.7-1t1-0.9 1.6-0.8 2-0.3q3 0 4.9 2t1.9 6z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button reddit shariff-nocustomcolor\" style=\"background-color:#ff5700\"><a href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678\" title=\"Share on Reddit\" aria-label=\"Share on Reddit\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#ff4500; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path fill=\"#ff4500\" d=\"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button pinterest shariff-nocustomcolor\" style=\"background-color:#e70f18\"><a href=\"https:\/\/www.pinterest.com\/pin\/create\/link\/?url=https%3A%2F%2Fwww.nico-maas.de%2F%3Fp%3D1678&media=https%3A%2F%2Fwww.nico-maas.de%2Fwordpress%2Fwp-content%2Fplugins%2Fshariff%2Fimages%2FdefaultHint.png&description=CUDA%20and%20Tensorflow%20in%20Docker\" title=\"Pin it on Pinterest\" aria-label=\"Pin it on Pinterest\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#cb2027; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 27 32\"><path fill=\"#cb2027\" d=\"M27.4 16q0 3.7-1.8 6.9t-5 5-6.9 1.9q-2 0-3.9-0.6 1.1-1.7 1.4-2.9 0.2-0.6 1-3.8 0.4 0.7 1.3 1.2t2 0.5q2.1 0 3.8-1.2t2.7-3.4 0.9-4.8q0-2-1.1-3.8t-3.1-2.9-4.5-1.2q-1.9 0-3.5 0.5t-2.8 1.4-2 2-1.2 2.3-0.4 2.4q0 1.9 0.7 3.3t2.1 2q0.5 0.2 0.7-0.4 0-0.1 0.1-0.5t0.2-0.5q0.1-0.4-0.2-0.8-0.9-1.1-0.9-2.7 0-2.7 1.9-4.6t4.9-2q2.7 0 4.2 1.5t1.5 3.8q0 3-1.2 5.2t-3.1 2.1q-1.1 0-1.7-0.8t-0.4-1.9q0.1-0.6 0.5-1.7t0.5-1.8 0.2-1.4q0-0.9-0.5-1.5t-1.4-0.6q-1.1 0-1.9 1t-0.8 2.6q0 1.3 0.4 2.2l-1.8 7.5q-0.3 1.2-0.2 3.2-3.7-1.6-6-5t-2.3-7.6q0-3.7 1.9-6.9t5-5 6.9-1.9 6.9 1.9 5 5 1.8 6.9z\"\/><\/svg><\/span><\/a><\/li><\/ul><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[531,78,406],"tags":[690,519,691,692],"class_list":["post-1678","post","type-post","status-publish","format-standard","hentry","category-docker","category-product-specific","category-python","tag-cuda","tag-docker","tag-nvidia","tag-tensorflow"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/piXYf-r4","jetpack-related-posts":[{"id":1187,"url":"https:\/\/www.nico-maas.de\/?p=1187","url_meta":{"origin":1678,"position":0},"title":"[Ubuntu] Install Docker","author":"Nico Maas","date":"14. January 2016","format":false,"excerpt":"This is a short guide to install the recent Docker Version from the official ppa on Ubuntu 14.04 LTS - along with some other great tools like docker-compose. Please bear in mind, that Docker needs an 64 Bit System to work with :)! So no i686 plattforms from here on.\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/www.nico-maas.de\/?cat=531"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1748,"url":"https:\/\/www.nico-maas.de\/?p=1748","url_meta":{"origin":1678,"position":1},"title":"Play with Docker - New Version Online","author":"Nico Maas","date":"1. November 2017","format":false,"excerpt":"In case you haven't noticed, we got a wonderful Halloween Gift from\u00a0Marcos Liljedhal and Jonathan Leibiusky - the all new Play with Docker is online! :) If you want to revisit the changes, just watch their video from Docker Con Europe 2017! PS: Please disable your Adblocker like uBlock Origin,\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/www.nico-maas.de\/?cat=531"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.nico-maas.de\/wordpress\/wp-content\/uploads\/pwd.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.nico-maas.de\/wordpress\/wp-content\/uploads\/pwd.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.nico-maas.de\/wordpress\/wp-content\/uploads\/pwd.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.nico-maas.de\/wordpress\/wp-content\/uploads\/pwd.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2051,"url":"https:\/\/www.nico-maas.de\/?p=2051","url_meta":{"origin":1678,"position":2},"title":"SonarQube 6.7 Community with Postgres 9.6 in Docker on Ubuntu","author":"Nico Maas","date":"30. April 2019","format":false,"excerpt":"This is a very quick install for SonarQube on Ubuntu 18.04 LTS. I presume you got the latest Docker CE 18.09 and docker-compose 1.24 installed. # create folders for sonarqube files and postgres sudo mkdir -p \/var\/sonarqube\/{conf,data,logs,extensions} sudo chown -R 999:999 \/var\/sonarqube sudo mkdir -p \/var\/sonarqube\/postgres # make folder for\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/www.nico-maas.de\/?cat=531"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1203,"url":"https:\/\/www.nico-maas.de\/?p=1203","url_meta":{"origin":1678,"position":3},"title":"[Docker] OpenWRT Images for x86, x64, Raspberry Pi and Raspberry Pi 2","author":"Nico Maas","date":"19. January 2016","format":false,"excerpt":"As some of you know, I am trying to learn to use Docker. I love the simplicity of this tool and the fact that a lot of my Appliances could be built and mainted more efficiently with the use of it. So I thought \"Well, I should at least try\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/www.nico-maas.de\/?cat=531"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1225,"url":"https:\/\/www.nico-maas.de\/?p=1225","url_meta":{"origin":1678,"position":4},"title":"[Talk] Docker Grundlagen","author":"Nico Maas","date":"4. June 2016","format":false,"excerpt":"My Docker 101 presentation @ SaarCamp 2016 (04.06.2016). Docker_Saarcamp2016.pdf (0,56 MB, PDF). Sourcecode \/ Example can be found on https:\/\/github.com\/nmaas87\/docker-demo","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/www.nico-maas.de\/?cat=531"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1220,"url":"https:\/\/www.nico-maas.de\/?p=1220","url_meta":{"origin":1678,"position":5},"title":"[Docker] Keep Docker Container up-to-date with Watchtower","author":"Nico Maas","date":"12. May 2016","format":false,"excerpt":"If you're using Docker, you know you will need to update these containers from time to time by hand. Mostly with an docker pull repo\/DockerContainerName and an docker-compose up -d. If you want to automate this, you can now use Watchtower: https:\/\/github.com\/CenturyLinkLabs\/watchtower Using it, is very easy. Just run following\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/www.nico-maas.de\/?cat=531"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=\/wp\/v2\/posts\/1678","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1678"}],"version-history":[{"count":6,"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=\/wp\/v2\/posts\/1678\/revisions"}],"predecessor-version":[{"id":1684,"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=\/wp\/v2\/posts\/1678\/revisions\/1684"}],"wp:attachment":[{"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nico-maas.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}