您的位置:首页 > 运维架构 > Docker

docker基础:Aufs存储驱动设定

2018-03-03 11:51 761 查看
本文用于记录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

事前确认

内核版本和操作系统版本:

root@ubuntu:/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
root@ubuntu:/home/devops#
root@ubuntu:/home/devops# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:    17.10
Codename:   artful
root@ubuntu:/home/devops#


docker版本

root@ubuntu:/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
root@ubuntu:/home/devops#


存储驱动确认:

root@ubuntu:/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
root@ubuntu:/home/devops#


设定daemon.json

可以在docker的systemd的设定文件中添加–storage-driver, 也可以直接设定damon.json,而在实际使用的时候更推荐使用damon.json的方式, 添加如下文件,如果已经有设定文件,则将storage-driver一行加入即可

root@ubuntu:/home/devops# cat /etc/docker/daemon.json
{
"storage-driver": "aufs"
}
root@ubuntu:/home/devops#


重启docker

root@ubuntu:/home/devops# systemctl daemon-reload
root@ubuntu:/home/devops# systemctl restart docker
root@ubuntu:/home/devops#


确认存储驱动类型

重启之后可以看到Storage Driver已经从overlay2变成aufs了。

root@ubuntu:/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
root@ubuntu:/home/devops#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: