From b973b346adadd622bfa83c55e7fd6d2276df9380 Mon Sep 17 00:00:00 2001 From: cyteen Date: Mon, 16 Mar 2026 01:06:21 +0000 Subject: [PATCH] Minor Changes. --- docker_daemon-writer.sh | 43 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/docker_daemon-writer.sh b/docker_daemon-writer.sh index 44f5fcb..cc64bf9 100644 --- a/docker_daemon-writer.sh +++ b/docker_daemon-writer.sh @@ -3,15 +3,17 @@ declare -A DOCKER_OPT -DOCKER_OPT[1]='.["authorization-plugins"] = [] | .["data-root"] = ""' -DOCKER_OPT[2]='.["dns"] = ["52.174.55.168","188.165.200.156"]' -DOCKER_OPT[3]='.["dns-opts"] = []' -DOCKER_OPT[4]='.["dns-search"] = []' -DOCKER_OPT[5]='.["exec-opts"] = ["native.cgroupdriver=cgroupfs"]' # if omitted docker defaults to cgroupfs v1 and docker exec will fail, /etc/rc.conf rc_cgroup_mode="unified" -DOCKER_OPT[6]='.["exec-root"] = ""' -DOCKER_OPT[7]='.["experimental"] = false' -DOCKER_OPT[8]='.["features"] = {}' -DOCKER_OPT[9]='.["storage-driver"] = "zfs"' +# This is a complete list of available options as of 2025 but some are empty here, +# They are kept here as reference. +DOCKER_OPT[1]='.["authorization-plugins"] = [] | .["data-root"] = ""' +DOCKER_OPT[2]='.["dns"] = ["52.174.55.168","188.165.200.156"]' +DOCKER_OPT[3]='.["dns-opts"] = []' +DOCKER_OPT[4]='.["dns-search"] = []' +DOCKER_OPT[5]='.["exec-opts"] = ["native.cgroupdriver=cgroupfs"]' # if omitted docker defaults to cgroupfs v1 and docker exec will fail, /etc/rc.conf rc_cgroup_mode="unified" +DOCKER_OPT[6]='.["exec-root"] = ""' +DOCKER_OPT[7]='.["experimental"] = false' +DOCKER_OPT[8]='.["features"] = {}' +DOCKER_OPT[9]='.["storage-driver"] = "zfs"' DOCKER_OPT[10]='.["storage-opts"] = ["zfs.fsname=rpool/docker"]' DOCKER_OPT[11]='.["labels"] = []' DOCKER_OPT[12]='.["live-restore"] = ["true"]' @@ -72,30 +74,27 @@ DOCKER_OPT[65]='.["default-addresses-pools"] = [{"base":"172.80.0.0/16","size":2 JSON_FILE="daemon.json" WORKDIR="/tmp" -if [ ! -f ${WORKDIR}/${JSON_FILE} ] -then - echo "{}" > ${WORKDIR}/${JSON_FILE} +if [ ! -f ${WORKDIR}/${JSON_FILE} ]; then + echo "{}" >${WORKDIR}/${JSON_FILE} else - echo "${WORKDIR}/${JSON_FILE} exists." + echo "${WORKDIR}/${JSON_FILE} exists." fi - # Count through the number of array elements, using ${# # looking for one missing. for ((i = 1; i < ${#DOCKER_OPT[@]}; ++i)); do - if [ -z "${DOCKER_OPT[$i]}" ]; then - echo Error: $i missing. - exit 1 - fi + if [ -z "${DOCKER_OPT[$i]}" ]; then + echo Error: $i missing. + exit 1 + fi done # Work through each array element, using ${!. # regardless how it's spelled. for i in "${!DOCKER_OPT[@]}"; do - OPTION="${DOCKER_OPT[$i]}" - jq "${OPTION}" ${WORKDIR}/${JSON_FILE} > ${WORKDIR}/${JSON_FILE}.new && \ - mv -b ${WORKDIR}/${JSON_FILE}.new ${WORKDIR}/${JSON_FILE} + OPTION="${DOCKER_OPT[$i]}" + jq "${OPTION}" ${WORKDIR}/${JSON_FILE} >${WORKDIR}/${JSON_FILE}.new && + mv -b ${WORKDIR}/${JSON_FILE}.new ${WORKDIR}/${JSON_FILE} done - cat ${WORKDIR}/${JSON_FILE} | jq