如何在Docker中创build文件系统卷?
Docker是否支持使用特定文件系统创build卷? 我无法find任何API调用,但我可以看到一些文件说它可以。
我正在用curl命令来试试这个:
curl -H "Content-Type: application/json" -X POST -d'{ "name":"visadfasfas","scope":"local","driver":local,"type":"tmpfs" }' https://<HOST-IP>:2376/volumes/create
所以它创build了音量,但是我看不到它的响应types。
看起来文件在这里列出了types
+---------------+---------------------+ | Technology | Storage driver name | +---------------+---------------------+ | OverlayFS | overlay or overlay2 | | AUFS | aufs | | Btrfs | btrfs | | Device Mapper | devicemapper | | VFS | vfs | | ZFS | zfs | +---------------+---------------------+
希望这是有帮助的。
是的,我们可以用docker中的特定文件系统创build一个卷,但是他们没有在任何文件中公开json。
我看到在文档中的以下提示,并尝试创buildJSON。
DriverOpts - A mapping of driver options and values. These options are passed directly to the driver and are driver
这是工作json的:
curl -H "Content-Type: application/json" -X POST -d'{ "Name": "vish-test-btrfs", "DriverOpts":{ "type":"<<<file-system-type>>>" }, "Scope": "local" }' https://<<<HOST_IP>>>>:2376/volumes/create <<<file-system-type>>> : can be btrfs, aufs etc ..
我们无法看到文件系统的响应types,validation的方法是
$ : cd <mount point of the volume> eg : $: cd /var/lib/docker/volumes/<<volume-Name>>/_data come one directory back $ : cd ..
你可以在这里看到.json文件,我们可以看到文件系统的types。
$: cat <filename.json>