Installing Tensorflow 2.0 on Ubuntu 18.04 using docker. Run all experiments from a container.

Abhishek Bose
3 min readDec 29, 2019

I have come across many developers who face serious issues when it comes to installing tensorflow on a linux distro such as Ubuntu. There are very few instances when the installation goes smoothly the first time itself. Mostly, the developer has to face a plethora of error messages which get quite tricky to solve. Some of the error messages are shown below:

[...\stream_executor\] Couldn't open CUDA library nvcuda.dll[...\stream_executor\cuda\] Unable to load cuDNN DSO

Similar error messages can be found in this official tensorflow link →

Let’s make things easier and lives simpler:

Enter Docker:

Using Docker containers the life of a developer becomes easier by a massive amount. Many developers shy away from using docker containers thinking that it introduces extra dependencies into the system followed by maintenance issues, but that’s a misconception.

Docker containers actually reduce the time spent on figuring out different library versions to be installed and how they would communicate with one another. Containers solve multiple issues which arise with incompatibility of libraries and version mismatch. A container is completely independent from it’s host and reduces the chances of ruining environments on the host machine

Installing Docker and NVIDIA Docker :

In order to run tensorflow as a container we would obviously need the latest version of docker to be installed and configured. Along with that we would also need NVIDIA Docker v2 to be installed on the host machine. NVIDIA Docker plays a beautiful role of exposing the host machine’s GPU and GPU drivers to a container. Hence the developer only has to worry about installing the correct NVIDIA GPU driver on this machine. The NVIDIA Docker v2 does the task of making it available for the container.

In order to learn how to install the latest version of Docker and NVIDIA Docker v2 , head over to my earlier post which describes this is in detail. Link given below:

Abhishek Bose

Machine Learning Engineer II at Swiggy. On a quest for technology.