Book Cover

Run Code Samples Using Docker

We’ve Done the Hard Part for You

What’s Docker?

Docker makes it easier to run applications by using containers. Simply, install Docker, login, then run any of our images in an isolated environment (a container) within seconds; you don’t have to install tools or dependencies to run our code samples when you use Docker.

Run Code Samples in Docker Containers

We organized our images by programming languge. Here are the available images we’ve created and loaded with pre-installed tools to save your time:

Language Image Entry-Point Command
Bash computingwithdata/bash bash
C++ computingwithdata/cpp bash
Java computingwithdata/java jshell
PowerShell computingwithdata/powershell pwsh
Python computingwithdata/python python3.7
R computingwithdata/r-base R

For example, to run the Python image in a container, run the following:

docker run -it --rm computingwithdata/python

You can always run a container with bash or sh as the entry-point command; for example:

docker run -it --rm computingwithdata/python bash

We’ve also included the code samples as files in each image, so that you don’t have to type them; that said, we believe that retyping code helps making it stick and improves the chances of learning new concepts successfully. Here’s an example of how to explore samples in the r-base image:

ls chapter*
## chapter2:
## log-scale.R  overflow.R  rounding.R  underflow.R
## 
## chapter7:
## conditionals.R  foo.R  running-compiled-code.R
## ... (truncated for brevity)