1. 程式人生 > >docker基礎:Aufs儲存驅動設定

docker基礎:Aufs儲存驅動設定

本文用於記錄ubuntu 17.10下docker 17.12.1-ce版本下overlay2的設定到aufs的方法。在Ubuntu 16.04以及更新的版本中,Linux核心引入了OverlayFS的支援,而且Docker CE也開始使用overlay2作為預設的儲存驅動,如果需要使用aufs,則需要進行手動配置。

什麼是AUFS 關於AUFS的簡單說明,可以參看如下文章:  http://blog.csdn.net/liumiaocn/article/details/52619008?locationNum=8&fps=1

如何安裝ubtuntu下的stable版的docker 詳細可以參看:http://blog.csdn.net/liumiaocn/article/details/79428035

事前確認核心版本和作業系統版本:

[email protected]:/home/devops# uname -a Linux ubuntu 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux [email protected]:/home/devops#  [email protected]:/home/devops# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description:    Ubuntu 17.10 Release:    17.10 Codename:   artful

[email protected]:/home/devops#docker版本

[email protected]:/home/devops# docker version Client:  Version:   17.12.1-ce  API version:   1.35  Go version:    go1.9.4  Git commit:    7390fc6  Built: Tue Feb 27 22:17:53 2018  OS/Arch:   linux/amd64

Server:  Engine:   Version:  17.12.1-ce   API version:  1.35 (minimum version 1.12)   Go version:   go1.9.4   Git commit:   7390fc6   Built:    Tue Feb 27 22:16:25 2018   OS/Arch:  linux/amd64   Experimental: false

[email protected]:/home/devops#儲存驅動確認:

[email protected]:/home/devops# docker info Containers: 0  Running: 0  Paused: 0  Stopped: 0 Images: 0 Server Version: 17.12.1-ce Storage Driver: overlay2  Backing Filesystem: extfs  Supports d_type: true  Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins:  Volume: local  Network: bridge host macvlan null overlay  Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 9b55aab90508bd389d7654c4baf173a981477d55 runc version: 9f9c96235cc97674e935002fc3d78361b696a69e init version: 949e6fa Security Options:  apparmor  seccomp   Profile: default Kernel Version: 4.13.0-21-generic Operating System: Ubuntu 17.10 OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 988.7MiB Name: ubuntu ID: TYYA:4LWB:YTHA:2DNB:XBXM:NFNP:ADMY:VZEJ:2ZBN:KPKW:PTML:S5A2 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries:  127.0.0.0/8 Live Restore Enabled: false

WARNING: No swap limit support [email protected]:/home/devops#

設定daemon.json 可以在docker的systemd的設定檔案中新增–storage-driver, 也可以直接設定damon.json,而在實際使用的時候更推薦使用damon.json的方式, 新增如下檔案,如果已經有設定檔案,則將storage-driver一行加入即可

[email protected]:/home/devops# docker info Containers: 0  Running: 0  Paused: 0  Stopped: 0 Images: 0 Server Version: 17.12.1-ce Storage Driver: aufs  Root Dir: /var/lib/docker/aufs  Backing Filesystem: extfs  Dirs: 0  Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins:  Volume: local  Network: bridge host macvlan null overlay  Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 9b55aab90508bd389d7654c4baf173a981477d55 runc version: 9f9c96235cc97674e935002fc3d78361b696a69e init version: 949e6fa Security Options:  apparmor  seccomp   Profile: default Kernel Version: 4.13.0-21-generic Operating System: Ubuntu 17.10 OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 988.7MiB Name: ubuntu ID: TYYA:4LWB:YTHA:2DNB:XBXM:NFNP:ADMY:VZEJ:2ZBN:KPKW:PTML:S5A2 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries:  127.0.0.0/8 Live Restore Enabled: false

WARNING: No swap limit support [email protected]:/home/devops#