This is basically a follow-up to this question, but now since the OS X Docker no longer needs Docker Toolbox (i.e. no longer needs VirtualBox), I'm totally lost how to switch from AUFS
to devicemapper
or something else.
The issue I'm facing here as well is the missing hardlink support in AUFS
which makes problems during the installation of the Android SDK, so I hope devicemapper
will help me here.
So, how can I change the storage driver of Docker's native implementation in OS X?
Even when using docker-for-mac you still have a virtualization under OSX using hyperkit/xhyve, since the Darwin kernel does still not run docker "natively". Thus you cannot chose a storage-driver like you actually are supposing. Also read the last bulletin point here https://docs.docker.com/docker-for-mac/docker-toolbox/#/the-docker-for-mac-environment
On docker-for-mac OSXFS is used to share your OSX local folders to the xhyve slim
vm
so the linux kernel/os(alpine) picks those up while starting the containers and binding any volumes to the 'vms file system' which is then synced.AFAIK there is no way to chose the storage driver under docker-for-mac, since it is not possible due to the way OSXFS syncs from the host to the alpine-vm which then offers this to the containers.
Matt is correct that the default Docker-for-Mac kernel doesn't support devicemapper, but in general, there's a better way to change the daemon options:
Start Docker for Mac. Click the whale in the menu bar, then click Preferences
Click
Click Advanced and provide the JSON for customizing your daemon settings.
Then click Apply & Restart, and check the change:
The Alpine Linux VM that Docker for Mac runs doesn't support the
devicemapper
driver but it can run theoverlay2
driver.There's no UI for managing this config yetThe Docker for Mac UI has been updated to include a "Daemon" section where you can edit thedocker.json
config file.Got to the Docker icon > "Preferences" > "Daemon" > "Advanced" and set the
storage-driver
tooverlay2
See kojiros answer for full step by step details.
Manual Config Editing
You can modify the Docker config files on your mac in
~/Library/Containers/com.docker.docker/Data/database
.This directory is a git repo and it will normally be blank:
There are files in the git database though
To retrieve the previous contents from git, run:
Edit the docker daemon config file that now exists, to include the
overlay2
storage driver.Docker on the VM will need most of
/var/lib/docker
removed before you can start with a new storage driver. This will DELETE all of your containers, images and volumes! Take backups of anything you need beforehand.Attach to the VM's tty with
screen
(brew install screen
if you don't have it)Login with
root
, no passwordExit the prompt with ctrl-d
Exit the screen session with ctrl-a then d
Now you can commit your changes back on the mac
Changes will be picked up automatically by Docker on commit and the VM will be restarted.
You now have a Docker for Mac VM running with the
overlay2
storage driver. If that doesn't resolve your problems, with some work you could probably figure out how to getdevicemapper
support working in the VM too. The steps once you've figured that out are all the same.Note Upgrades to Docker for Mac can cause some weirdness. Last upgrade all my containers/images disappeared from a
docker ps
ordocker images
. I had to reset the git repository again and restart Docker for my config changes to come back, then all the data came back.