docker intro

October 12, 2017   

This is my notes on using docker on my Fedora workstation

Install

Docker consists of a client server architecture. There is the dockerd or docker deamon which runs as a started service. You interface with dockerd via the docker binary.

To get started you need to install docker and then start the dockerd deamon via sudo systemctl start docker

Installing docker can be surprisingly irratating. This isn’t because its hard to do but rather you’ll find a couple of different versions and places you can install it from. Likely docker will be available in your disto package manager. This will install easily but likely they will have tampered with some of its default behaviours or be a older release. As such documentation you find online might not fully apply to your installed docker. Docker itself distributes Docker EE (enterprise edition) and Docker CE (Community Edition). Docker appears to be taking a “Fedora/RHEL” approach here.

A fairly good description of the different versions can be found on Stack OverFlow

For the purposes of my experimenting with docker I installed on Fedora via yum this worked fine.

Overview

Docker is really a mush-mash of Linux technology. In my opinion the best article on the web which discusses this is on Jessie Frazelle’s blog

One thing that is good to keep in mind about docker is that docker containers are intended to be “process” containers rather then full OS virtual servers. Probably one of the best overviews on the internet detailing the differences between these things was Mark Shuttleworth’s presention Canonical: OpenStack with Containers: Replacing VMs with Fast and Secure Machine Containers which was given at OpenStack Summit Barcelona.

Basic Operations

So after you’ve installed and started docker daemon you now need to interact with it using the docker command, for example listing all your container processes via the “docker ps” command:

[ajmaidak@antec httpd-ex]$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Obviously I have no running container processes.

docker cli takes a little getting used to. You’ll interact with “containers” and “images”. Containers are running or stopped images.

To see all images: sudo docker images

To see all containers - even stopped: sudo docker ps -a

To remove an image: sudo docker rmi image-name-or-id

To remove a container: sudo docker rm container-name-or-id

Docker requires a copy on write storage driver. There’s a long history of various drivers it supports, but basically container images are COW children of their parent images via overlay or snapshoting mechism as defined by teh storage driver. As such deleation of parent images requires that all child images be removed

Docker hub

Docker images are pulled from a web service called the docker hub.