mkdir -p /etc/docker if [ ! -f /etc/docker/daemon.json ] then touch /etc/docker/daemon.json echo "{}" > /etc/docker/daemon.json else echo "/etc/docker/daemon.json exits." fi DOCKER_OPT[0]='.["dns"] = ["52.174.55.168","188.165.200.156"]' DOCKER_OPT[1]='.["storage-driver"] = "zfs"' #DOCKER_OPT[2]='.["storage-opts"] = ["zfs.fsname=rpool/docker","size=256"]' DOCKER_OPT[2]='.["storage-opts"] = ["zfs.fsname=rpool/docker"]' #DOCKER_OPT[3]='.["insecure-registries"] = ["soleine.lan:5000"]' DOCKER_OPT[3]='.["insecure-registries"] = ["192.168.1.198:5000"]' for ((i = 0; i < ${#DOCKER_OPT[@]}; ++i)); do OPTION="${DOCKER_OPT[$i]}" jq "${OPTION}" /etc/docker/daemon.json > /tmp/daemon.json.new && \ mv -b /tmp/daemon.json.new /etc/docker/daemon.json done