Building a container for development

What's a container? A container is Docker's name for a VM with a certain configuration of operating system and software. In our case, it'll be the piece that allows us to change our configuration from chapter to chapter without having to worry about installing new packages to learn a new package. Docker containers allow us the flexibility to have a different development environment for every chapter with minimal downtime. For each of these chapters, you will be supplied with a corresponding Dockerfile that represents the base configuration for completing the recipe.

This section will simply explain a small example Dockerfile to give you an idea of how powerful these particular tools are. Here's the example we are going to cover:

FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
ARG KERAS=2.2.0
ARG TENSORFLOW=1.8.0

# Update the repositories within the container

RUN apt-get update

# Install Python 2 and 3 + our basic dev tools

RUN apt-get install -y
python-dev
python3-dev
curl
git
vim

# Install pip

RUN curl -O https://bootstrap.pypa.io/get-pip.py &&
python get-pip.py &&
rm get-pip.py

# Install Tensorflow and Keras

RUN pip --no-cache-dir install
tensorflow_gpu==${TENSORFLOW}
keras==${KERAS}

This is the basics of how you will build a basic image for the rest of the chapters in this book. This is called the base_image for this book and will be inherited by almost every chapter from now on.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.163.250