csi customization docker-for-desktop kubernetes

Adding a second disk to Docker-for-Desktop

Docker-for-Desktop (DfD) is absolutely easy for the first steps and seconds steps with Containers. Even to start with Kubernetes is just push of a button away.

So why adding an additional disk. When playing with the Container-Storage-Interface (CSI) of Kubernetes there is sometimes raw storage needed. So instead of re-use the given storage via loopback devices I ended up adding a second disk to DfD.

To  accomplish the original Hyperkit binary has to be moved aside and replaced by a wrapper script to prepend(!) the 2nd disk, because DfD will always grab the last disk as its data disk.

The setup steps are listed below.

The wrapper first defines the additional disks name and size. Then it goes through all given parameters and if the parameter is for the actual Docker.raw disk image it will replace it with the additional disk name. It will then check if the image file for the additional disk is in place or create it (aside the Docker.raw disk image).

Finally it will append the original Docker.raw disk parameter to the list of parameters and will exec() into the original Hyperkit binary.

Leave a Reply

Your email address will not be published. Required fields are marked *