Docker for Mac and Kubernetes

From this article you will learn how to create a local Kubernetes cluster using Docker for Mac
28 February 2018   3534

Since version 17.12 CE Edge, Docker for Mac comes with Kubernetes. Now, to create a local Kubernetes cluster, there is no need to use additional tools like Minikube. As an experiment, let's try to deploy a small service on the cluster and see what happens.

At the time of writing, I have the latest version of Docker for Mac - 18.02.0.


For the experiment, I wrote a simple short links generator on Go — brevity. The service is divided into 2 parts: an API for generating short links and their handler. PostgreSQL is used for data storage.

To deploy it and all the necessary dependencies, we need Helm — a package manager for Kubernetes, which significantly simplifies the process of deployment and further support of various services. To install it, we use Homebrew:

$ brew install kubernetes-helm

After installation, we need to initialize Helm:

$ helm init

If you have access to several Kubernetes clusters, then you will need to switch to local:

$ kubectl config use-context docker-for-desktop

The preparation is complete, now we are ready to install the necessary services. The first step is to install PostgreSQL:

$ helm install --name pg --namespace db --set postgresPassword=postgres,persistence.size=1Gi stable/postgresql

Helm allows you to override the default values and thereby configure the service for your own needs. The list of services that can be installed through Helm can be found here —

Now we need to make sure that the service is installed and working correctly:

$ kubectl get pods -n db
NAME                            READY     STATUS                       RESTARTS   AGE
pg-postgresql-bbd4bbb5c-njkzs   0/1       CreateContainerConfigError   0          

The service was not started because of an error. To learn more, just run the following command:

$ kubectl describe pods -n db pg-postgresql-bbd4bbb5c-njkzs | tail -n 1
Warning  Failed                  (x4 over 19s)  kubelet, docker-for-desktop  Error: lstat /Users/mgrachev/.docker/Volumes/pg-postgresql/pvc-588afa8b-0e90-11e8-8d22-025000000001: no such file or directory

Kubernetes does not see the directory, although it actually exists. It turned out that Docker for Mac does not understand the subPath option in the PostgreSQL configuration for Kubernetes. In Minikube there was such a problem too, but it was already fixed.

To solve this problem, we will need to edit Deployment for PostgreSQL:

$ kubectl edit deployment -n db pg-postgresql

And delete the following line:

subPath: postgresql-db

Now, if we look again at the list of running pods, we would see that there are no errors and the service is launched:

$ kubectl get pods -n db
NAME                             READY     STATUS    RESTARTS   AGE
pg-postgresql-5c954c46c6-6bt2t   1/1       Running   0          26s

Next, we need to create a database for brevity. First we go into the container:

$ kubectl exec -it -n db pg-postgresql-5c954c46c6-6bt2t bash

Inside the container, run psql on behalf of the postgres user and create the database:

root@pg-postgresql-5c954c46c6-6bt2t:/# gosu postgres psql
postgres=# CREATE DATABASE brevity_production;

In order for our application to be accessible from the cluster, we need the Ingress Controller. For these purposes, nginx would be fine:

$ helm install --name nginx stable/nginx-ingress

Go to the installation brevity. We clone the project and run the helm install command, but as an argument we pass the path to the pre-prepared chart (the packages in Helm are called the charts):

$ git clone
$ cd brevity
$ helm install --name brevity ./helm

Let’s check that all services are running:

$ kubectl get pods
NAME                                                   READY     STATUS    RESTARTS   AGE
brevity-brevity-778799dd4-zlb6g                        1/1       Running   0          1h
nginx-nginx-ingress-controller-c8cf56768-h4txk         1/1       Running   0          1h
nginx-nginx-ingress-default-backend-864c9484bf-rfdq4   1/1       Running   0          1h

Next, we'll try to generate a short link by sending a POST request to the brevity API:

$ curl -X "POST" "http://localhost/api/v1/shortlink" --data-urlencode "url="

We go to it to make sure that everything works. We can also look at the logs: 

$ kubectl logs brevity-brevity-778799dd4-zlb6g
time="2018-02-19T09:31:03Z" level=info msg="HTTP Server started at port: 80"
time="2018-02-19T09:32:35Z" level=info msg="Successful returns a short link, short: http://localhost/MyAyEy, original:"
time="2018-02-19T09:32:43Z" level=info msg="Redirect to, using token: MyAyEy"

As can be seen from the logs, the service successfully processed a short link and redirected to This completes our experiment.

In conclusion, I'm glad to see Docker for Mac with Kubernetes support. It's enough to make one click in the settings and at your disposal there will be a completely ready-to-work cluster with Kubernetes on board. On the other hand, I note that this is still an unstable version and there may be various kinds of errors. But even now, it is quite suitable for local development and testing.

Mikhail Grachev, senior ruby developer, Evrone

Canonical to Represent Minimal Ubuntu

New version of Ubuntu is created for servers, isolated containers based on Docker and cloud systems
12 July 2018   382

Ubuntu team presented a simplified version of the base image - Minimal Ubuntu. It is designed for servers, isolated containers based on Docker and cloud systems. The release features high performance, minimal load time and automation of applications in the cloud.

The small footprint of Minimal Ubuntu, when deployed with fast VM provisioning from GCE, helps deliver drastically improved boot times, making them a great choice for developers looking to build their applications on Google Cloud Platform.

Paul Nash

Group Product Manager, Google Cloud

The authors of the project emphasize the size of the distribution kit, which "weighs" 157 MB, and also supports the main cloud systems like Amazon EC2, Google Compute Engine (GCE), LXD and KVM / OpenStack, each of which has its own optimized version of the package. In addition, the OS-based image for operating with containers based on the Docker platform, compatible with the Kubernetes.

Minimal Ubuntu is designed for automated execution, so it includes only a minimal set of tools. The distribution can be upgraded to a set of Ubuntu Server packages using the special utility "unminimize", which returns components that are convenient for interactive management.

According to Canonical representatives, the deletion of the manual control functions resulted in the acceleration of the load time by 40% and the reduction of the occupied disk space by 50%. At the same time, this release remained completely compatible with all the packages from standard Ubuntu repositories. Required packages can be installed using the standard package manager apt or using snapd, which are included in the distribution by default.

Two assemblies are available for download, based on Ubuntu 16.04 LTS and 18.04 LTS. You can download them on the official website.