docker 使用 btrfs ubuntu

docker with btrfs ubuntu

我需要帮助才能使用 btrfs 启动 docker 守护程序。

当我尝试使用 -s btrfs 启动它时,守护进程不想启动。尝试使用 btrfs 启动 docker 守护程序时,日志中出现错误(错误的文件系统?)。

我使用 ubuntu 作为 OS :

root@ionutmos-VirtualBox:/etc/default# uname -a
Linux ionutmos-VirtualBox 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8    09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux 

我在 /var/lib/docker2 上使用 btrfs 安装了一个新分区。

    /dev/sda       btrfs     52428800     512  50302720   1% /var/lib/docker2

我安装了 1.6.2 docker 版本:

/etc/default# docker version
Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 7c8fca2
OS/Arch (client): linux/amd64
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 7c8fca2
OS/Arch (server): linux/amd64

我编辑了“/lib/systemd/system/docker.service”文件,它看起来像这样:

Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
EnvironmentFile=-/etc/default/docker
ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
Also=docker.socket

我在 /etc/default/docker 文件中插入了 2 个选项:

OPTIONS="--storage-driver btrfs"
DOCKER_OPTS="-s btrfs"

当我尝试手动启动 docker 守护程序时,此错误出现在日志中:

FATA[0000] Shutting down daemon due to errors: error intializing graphdriver: prerequisites for driver not satisfied (wrong filesystem?)

这是整个日志文件:

root@ionutmos-VirtualBox:/usr/lib/system-service# docker -d -D -s btrfs
DEBU[0000] waiting for daemon to initialize
INFO[0000] +job serveapi(unix:///var/run/docker.sock)
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
DEBU[0000] Registering GET, /images/{name:.*}/get
DEBU[0000] Registering GET, /images/{name:.*}/history
DEBU[0000] Registering GET, /images/{name:.*}/json
DEBU[0000] Registering GET, /_ping
DEBU[0000] Registering GET, /events
DEBU[0000] Registering GET, /images/json
DEBU[0000] Registering GET, /images/get
DEBU[0000] Registering GET, /containers/{name:.*}/changes
DEBU[0000] Registering GET, /containers/{name:.*}/logs
DEBU[0000] Registering GET, /exec/{id:.*}/json
DEBU[0000] Registering GET, /containers/{name:.*}/attach/ws
DEBU[0000] Registering GET, /images/search
DEBU[0000] Registering GET, /containers/json
DEBU[0000] Registering GET, /containers/{name:.*}/export
DEBU[0000] Registering GET, /containers/{name:.*}/json
DEBU[0000] Registering GET, /containers/{name:.*}/top
DEBU[0000] Registering GET, /containers/{name:.*}/stats
DEBU[0000] Registering GET, /info
DEBU[0000] Registering GET, /version
DEBU[0000] Registering GET, /images/viz
DEBU[0000] Registering GET, /containers/ps
DEBU[0000] Registering POST, /auth
DEBU[0000] Registering POST, /exec/{name:.*}/start
DEBU[0000] Registering POST, /exec/{name:.*}/resize
DEBU[0000] Registering POST, /images/create
DEBU[0000] Registering POST, /images/load
DEBU[0000] Registering POST, /images/{name:.*}/push
DEBU[0000] Registering POST, /containers/{name:.*}/start
DEBU[0000] Registering POST, /containers/{name:.*}/rename
DEBU[0000] Registering POST, /containers/{name:.*}/exec
DEBU[0000] Registering POST, /build
DEBU[0000] Registering POST, /containers/{name:.*}/unpause
DEBU[0000] Registering POST, /containers/{name:.*}/restart
DEBU[0000] Registering POST, /containers/{name:.*}/wait
DEBU[0000] Registering POST, /containers/{name:.*}/attach
DEBU[0000] Registering POST, /containers/{name:.*}/copy
DEBU[0000] Registering POST, /containers/{name:.*}/resize
DEBU[0000] Registering POST, /commit
DEBU[0000] Registering POST, /images/{name:.*}/tag
DEBU[0000] Registering POST, /containers/create
DEBU[0000] Registering POST, /containers/{name:.*}/kill
DEBU[0000] Registering POST, /containers/{name:.*}/pause
DEBU[0000] Registering POST, /containers/{name:.*}/stop
DEBU[0000] Registering DELETE, /containers/{name:.*}
DEBU[0000] Registering DELETE, /images/{name:.*}
DEBU[0000] Registering OPTIONS,
DEBU[0000] docker group found. gid: 125
FATA[0000] Shutting down daemon due to errors: error intializing graphdriver: prerequisites for driver not satisfied (wrong filesystem?)

Adrian Mouat 推荐是我问题的答案。

Docker 我是这样开始使用btrfs的:

    /usr/bin/docker -d -g /var/lib/docker2

非常感谢。