Hi, Today we’re going to look at some awesome docker tools! Let’s get right to it!

Dive

Dive is a cool tool, it allows you to “dive” into a docker image and see info about file size, and structure in your image, It also allows you to see exactly what file changes occured in all layers of the image.

Screenshot of Dive program

Example of an inspected image.

In this example, you can see some crucial details, for example, the total image size, and the estimated amount of waisted space.
In this case, we’re using the node:13-alpine image as a base, so most of the wasted space is in their image (removing things later on would not help, as these changes were in earlier layers.)

On the right side, you can see all additions (green) and removals (red) that have happened in this layer, for this layer, we used a copy command to copy files from a build image into our new, smaller image.

You can find more info about dive (and how to install it) on Github.

Kaniko

Kaniko is an application that let’s you build a docker image in docker, without dind (Docker-in-Docker.)

It’s speed is a lot better than using dind, as it isn’t using the docker socket to build the image.

I’m right now trying to convert projects I work on to kaniko!

You can find an example .gitlab-ci.yml file here
You can find the project here (Github).

Saltstack

Not really a tool for docker, but it can run docker images on your servers,
Super useful if you already use saltstack for deploying servers and applications.

I’ve not seen it around a lot, but it’s seriously a good tool to deploy things on your servers.

For example, I’ve got an application server that runs some stuff I want in my house, Influx (+Telegraf on all my VM’s) runs on this one.

Here’s an example of how to run Influx on a server:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
include:
- docker

{% set appContainerName = pillar.influx.name|default('influx') %}

influx-data-dir:
file.directory:
- name: /opt/influx
- makedirs: true

influx-db:
docker_container.running:
- name: {{ appContainerName }}
- image: quay.io/influxdb/influxdb:{{ pillar.influx.version }}
- start: true

- binds:
- /opt/influx:/root/.influxdbv2

- entrypoint:
- "/entrypoint.sh"
- "--reporting-disabled"

- restart_policy: unless-stopped

- network_mode: host

- publish:
- {{ pillar.influx.port|default(9999) }}:9999

- labels:
- salt-managed

- require:
- service: docker
- file: influx-data-dir

Here we use the docker_container.running state to setup a container (influxdb on quay.io) to run on a specific port.
I won’t go into the specifics, but a lot of it is self-explanatory, and uses some syntax you also see in docker cli.

Gitlab Container Registry

A private (or public, depending on your usecase) container registry, built right into Gitlab.

A very easy to use platform to get your containers on, if you don’t want your applications hosted on external servers (Dockerhub, Quay, etc.)

Here‘s a link on how to set up the registry.


That’s it from me today, next time, we’ll talk about some cool tools for Kubernetes. Stay tuned!