Centos Docker Storage Using ZFS

Set Config

  1. vim /etc/sysconfig/docker-storage
    DOCKER_STORAGE_OPTIONS='--storage-driver=zfs'

  2. vim /etc/sysconfig/docker
    OPTIONS='--graph=/local/docker'

  3. mkdir -p /local/docker

  4. zfs create -o mountpoint=/local/docker tank/docker

Start And Test ZFS Snapshot

  1. systemctl start docker

  2. docker pull busybox

  3. docker run --name=lmy -it busybox /bin/sh

  4. docker ps -l

  5. zfs snap -r tank/docker@xxx

  6. rm -rf /local/docker

  7. zfs rollback -r tank/docker@xxx

  8. systemctl restart docker

  9. docker start -i lmy

Issues

  1. pull 不下来image
    `mkdir -p /etc/systemd/system/docker.service.d/;
    echo "[Service]" > http-proxy.conf;
    echo Environment="HTTP_PROXY=http:<your proxy ip>/" > http-proxy.conf`

  2. /etc/sysconfig/docker中--graph参数, 即docker的root目录不能是默认的/var/lib/docker
    否则zfs rollback 之后restart 会失败, 目前还不知道原因.

  3. zfs rollback 之后必须先restart docker, 如果直接start container会报错.


dreambei
132 声望4 粉丝

引用和评论

0 条评论