Being naughty with ZFS

Hi,

I have been experimenting with ZFS snapshotting, Images and Containers between servers as a docker export/save + transfer + docker import/load is quite time consuming. I am not an expert in any shape of form but thought I’d try experimenting to see what happened:

6GB container (don’t ask - just pitb software I’m using) with the above sequence took 40 ish minutes.

Instead:
ServerA, ServerB

1.image

ServerA

docker images|grep 17136
j2systems/docker HS2016.2.1.806.0.17136 a12b7f98a7c9 2 weeks ago 6.23GB

docker inspect a12b7f98a7c9|jq -r '.[].GraphDriver.Data.Dataset’
rpool/ROOT/1ec53ecd3e72ddfdd3cd42cc49cb556b2dde21b57555baf081675e0ca836ed2b

zfs snapshot rpool/ROOT/1ec53ecd3e72ddfdd3cd42cc49cb556b2dde21b57555baf081675e0ca836ed2b@s1

ServerB

mkdir /tmp/test
cd /tmp/test
touch placeholder
echo -e “FROM scratch\nADD placeholder /tmp\nENTRYPOINT [”/sbin/sh"]" > Dockerfile
[root@dockertemp test]# docker build . -t this:that
Sending build context to Docker daemon 2.56kB
Step 1/3 : FROM scratch
—>
Step 2/3 : ADD placeholder /tmp
—> Using cache
—> faef9b72bbb6
Step 3/3 : ENTRYPOINT /sbin/sh
—> Using cache
—> 6b035ddef58f
Successfully built 6b035ddef58f
Successfully tagged this:that
[root@dockertemp test]#
[root@dockertemp test]# docker inspect 6b035ddef58f|jq -r '.[].GraphDriver.Data.Dataset’
rpool/ROOT/56f61bfbe0c273e6e28d0b55bf38a8475410cb86259ab3fe0e039ab402271bf0
[root@dockertemp test]#
zfs destroy rpool/ROOT/56f61bfbe0c273e6e28d0b55bf38a8475410cb86259ab3fe0e039ab402271bf0

ServerA

zfs send rpool/ROOT/1ec53ecd3e72ddfdd3cd42cc49cb556b2dde21b57555baf081675e0ca836ed2b@s1|ssh root@ServerB zfs recv rpool/ROOT/56f61bfbe0c273e6e28d0b55bf38a8475410cb86259ab3fe0e039ab402271bf0

ServerB
zfs unmount rpool/ROOT/56f61bfbe0c273e6e28d0b55bf38a8475410cb86259ab3fe0e039ab402271bf0
docker run -it ……… this:that

2.Container.

Almost the same but spin up scratch image to get container:

ServerA

docker ps -a|grep TestContainer
adb01fddd9f2 another:container “/sbin/sh” 2 weeks ago Exited (0) 44 minutes ago

docker inspect adb01fddd9f2 |jq -r '.[].GraphDriver.Data.Dataset’
rpool/ROOT/47258a5d96e12b801d789f1a439fac93191518949107d9a595e6fff86eea3002

zfs snapshot rpool/ROOT/47258a5d96e12b801d789f1a439fac93191518949107d9a595e6fff86eea3002@s1

ServerB

mkdir /tmp/test
cd /tmp/test
touch placeholder
echo -e “FROM scratch\nADD placeholder /tmp\nENTRYPOINT [”/bin/sh"]" > Dockerfile
[root@dockertemp test]# docker build . -t this:that
Sending build context to Docker daemon 2.56kB
Step 1/3 : FROM scratch
—>
Step 2/3 : ADD placeholder /tmp
—> Using cache
—> faef9b72bbb6
Step 3/3 : ENTRYPOINT /sbin/pseudo-init
—> Using cache
—> 6b035ddef58f
Successfully built 6b035ddef58f
Successfully tagged this:that
[root@dockertemp test]#docker run -d --name RemoteContainer -h RemoteContainer this:that
Error: docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: “/sbin/sh”: stat /sbin/sh: no such file or directory”.

[root@dockertemp test]# docker inspect wallop|jq -r '.[].GraphDriver.Data.Dataset’
rpool/ROOT/4235b6cae7252af14f79ff3fea5b49065fa1983c8d11726b92a8c1718442b223
[root@dockertemp test]#
zfs destroy rpool/ROOT/4235b6cae7252af14f79ff3fea5b49065fa1983c8d11726b92a8c1718442b223

ServerA

zfs send rpool/ROOT/47258a5d96e12b801d789f1a439fac93191518949107d9a595e6fff86eea3002@s1|ssh root@ServerB zfs recv rpool/ROOT/4235b6cae7252af14f79ff3fea5b49065fa1983c8d11726b92a8c1718442b223

ServerB
zfs unmount rpool/ROOT/4235b6cae7252af14f79ff3fea5b49065fa1983c8d11726b92a8c1718442b223
docker start RemoteContainer

docker stop RemoteContainer
docker start TestContainer
change some stuff
docker stop TestContainer
zfs snapshot rpool/ROOT/47258a5d96e12b801d789f1a439fac93191518949107d9a595e6fff86eea3002@s2
zfs send -i rpool/ROOT/47258a5d96e12b801d789f1a439fac93191518949107d9a595e6fff86eea3002@s1 rpool/ROOT/47258a5d96e12b801d789f1a439fac93191518949107d9a595e6fff86eea3002@s2|ssh root@ServerB zfs recv rpool/ROOT/4235b6cae7252af14f79ff3fea5b49065fa1983c8d11726b92a8c1718442b223
docker start RemoteContainer
Changes are there!
Total time, 6GB image, 6 minutes.

No errors in dmesg, etc

Comments, not too derogatory, appreciated