Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Use overlay2 driver as default for user docker #2194

Closed
niusmallnan opened this issue Dec 28, 2017 · 4 comments
Closed

Use overlay2 driver as default for user docker #2194

niusmallnan opened this issue Dec 28, 2017 · 4 comments

Comments

@niusmallnan
Copy link
Contributor

As we have a higher kernel version and docker version.
It is better to use the overlay2 driver for user docker.

See: https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/

Note: If you use OverlayFS, use the overlay2 driver rather than the overlay driver, because it is more efficient in terms of inode utilization. To use the new driver, you need version 4.0 or higher of the Linux kernel.

@niusmallnan niusmallnan self-assigned this Dec 28, 2017
@niusmallnan niusmallnan added this to the v1.1.3 milestone Dec 28, 2017
@niusmallnan
Copy link
Contributor Author

I realized this may cause problems with ros os upgrade.
Because overlay and overlay2 cannot be compatible, earlier versions used overlay by default.

@thaJeztah
Copy link

thaJeztah commented Jan 10, 2018

If no explicit storage-driver is set (by configuration, e.g. the --storage-driver option, or a daemon.json configuration file), the docker daemon will try storage-drivers using a priority list; https://github.com/moby/moby/blob/master/daemon/graphdriver/driver_linux.go#L50-L51

During startup, the daemon first determines all the supported storage-drivers, then checks for existing storage-driver directories in /var/lib/docker. If an existing directory was found, it will select that storage directory; https://github.com/moby/moby/blob/bd8a9c25ee257384ca24cf32e61b6b0ef71f521d/daemon/graphdriver/driver.go#L205-L249

So if a host previously didn't support overlay2 and was using overlay, then a /var/lib/docker/overlay directory is found, and the daemon will continue using that.

But if (on the same host), the /var/lib/docker directory is "clean", and no previous directory was found for a storage-driver, it will select the first supported driver from the priority list (which should be overlay2 on a 4.x kernel (unless it finds that the underlying filesystem is btrfs or zfs)

@niusmallnan
Copy link
Contributor Author

niusmallnan commented Jan 15, 2018

@thaJeztah Thanks your comment.
I also prefer to let Docker automatically detect the storage-driver.

According to this mechanism, overlay2 will be the preferred option.

@kingsd041
Copy link
Contributor

Tested with RancherOS v1.2.0-rc2
If you upgrade from an earlier version to v1.2.0-rc2, docker continues to use the overlay driver.
If based on v1.2.0-rc2 launch instance, the default is overlay2 driver

However, if I use docker-machine launch instance, the default is overlay driver

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants