Docker Containers: Build and Deploy with Kubernetes, Flannel, Cockpit, and Atomic by Christopher Negus

The book Docker Containers: Build and Deploy with Kubernetes, Flannel, Cockpit, and Atomic by Christopher Negus is an awesome book for those who want to have an introduction to Docker and advanced concepts like Kubernetes. It’s easy to read and concise, one of the best books I’ve read so far and I’ve read many of them about Docker:). Chapters are clear and “short”, with short I mean they are not full of boring information, you’ll start working with containers right away.

It was published at the end of 2015 and still valid of course!, but as usual and inevitable due to the nature of Docker container evolution… some commands (really few) may fail so I’m sharing with you in this post some updates. If you’re reading the book and something doesn’t work as expected this could help. I’m using the O’Reilly Safari version in case it differs from yours.

Chapter 7 – Start a Container to inspect

The following command:

docker run -d -p 8080:8080 --name="fed_web"   \
--restart="on-failure:5"  -w /var/www/html    \
-v /var/www/html:/var/www/html                \
fedora python -m SimpleHTTPServer 8080

Should be changed to:

docker run -d -p 8080:8080 --name="fed_web"   \
--restart="on-failure:5"  -w /var/www/html    \
-v /var/www/html:/var/www/html                \
fedora python3 -u -m http.server 8080

Seems that the latest fedora container is not providing python 2.7 by default and python3 is the only available python. Thanks to the -u with python3 the outputs are not buffered and sent to STDOUT so you can use docker attach, docker logs… More info for that -u option here.

Chapter 7 – Using docker exec to Start a New Process in a Running Container

In recent Fedora versions (23 onwards) it seems that we have to start saying goodbye to yum and say hello to dnf. So to avoid warnings, it’s best to change:

docker exec -it fed_web yum install net-tools -y

With:

docker exec -it fed_web dnf install net-tools -y

Chapter 9 – Mounting sockets

Once again the dnf issue 🙂 It’s best to change:

RUN yum -y update; yum -y install systemd-libs docker; yum clean all

With:

RUN dnf -y update; dnf -y install systemd-libs docker; dnf clean all

To avoid ugly warnings.

Chapter 11 – Summary

As a rule, keep an eye on the amount of disk space available in the /var/log/dockerdirectory,

Should be:

As a rule, keep an eye on the amount of disk space available in the /var/lib/dockerdirectory,

Chapter 16 – Step 2: Set Up Kubernetes Master

The

KUBE_API_ADDRESS="--address=0.0.0.0" 

configuration line for our master server should be

KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0" as --address

has been deprecated.

The

KUBE_SERVICE_ADDRESSES="--portal_net=10.254.0.0/16" 

configuration line should be 

KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"

Cheers!