Learning to use Docker

March 23, 2020

Video @JakeWright: Learn Docker in 12 Minutes

He covers: 1. What is Docker 2. Virtual Machines vs. Docker 3. Introduction to Dockerfiles, images and containers 4. The Docker Hub 5. Writing a Dockerfile 6. Building an image 7. Running a container 8. Mounting volumes 9. One process per container

In a new folder (docker), create a subfolder (src) and inside that a file index.php:


echo "hello world";

Then in the docker folder create your Dockerfile:

# Dockerfile
FROM php:7.0-apache
COPY /src/ /var/www/html/

Build it:

docker build -t hello-world .

Then run it:

docker run -p 80:80 hello-world

Now run it with your src folder mounted as a volume:

docker run -p 80:80 -v ~/docker/src:/var/www/html/ hello-world

and you can edit the php folder and see the changes live.

Docs: Dockerfile reference

Docs: Volumes

Video: Docker Compose in 12 Minutes

@JakeWright’s Source Code

Jupyter Notebooks Docker Images

Dependencies of Jupyter Notebook Images

Geographic Data Science Notebook Stack

So Dani’s Docker image for a GDS stack makes most sense when understood precisely as a geospatial variant on the Jupyter Notebook Docker images, with darribas/gds_py:4.0 inheriting from jupyter/minimal-notebook, and darribas/gds then inheriting from his gds_py and adding R and the tidyverse.

Just like Jupyter’s r-notebook and scipy-notebook inherit from minimal-notebook, and then datascience-notebook inherits from scipy-notebook and adds R and Julia.

@BretFisher’s Docker Mastery Udemy Course ~ 20 Hrs

Running GUI applications in a contaner

docker run -it --net=host -e DISPLAY=$DISPLAY -e \
--name <container_name> <image_name>