Docker ZFS Storage

Centos Docker Storage Using ZFS

Set Config

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

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

  3. mkdir -p /local/dockerrest

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

Start And Test ZFS Snapshot

  1. systemctl start dockerget

  2. docker pull busyboxit

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

  4. docker ps -lim

  5. zfs snap -r tank/docker@xxxdi

  6. rm -rf /local/dockerpoi

  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會報錯.

相關文章
相關標籤/搜索