Minor Changes.
This commit is contained in:
parent
eba4a86db4
commit
b973b346ad
|
|
@ -3,15 +3,17 @@
|
||||||
|
|
||||||
declare -A DOCKER_OPT
|
declare -A DOCKER_OPT
|
||||||
|
|
||||||
DOCKER_OPT[1]='.["authorization-plugins"] = [] | .["data-root"] = ""'
|
# This is a complete list of available options as of 2025 but some are empty here,
|
||||||
DOCKER_OPT[2]='.["dns"] = ["52.174.55.168","188.165.200.156"]'
|
# They are kept here as reference.
|
||||||
DOCKER_OPT[3]='.["dns-opts"] = []'
|
DOCKER_OPT[1]='.["authorization-plugins"] = [] | .["data-root"] = ""'
|
||||||
DOCKER_OPT[4]='.["dns-search"] = []'
|
DOCKER_OPT[2]='.["dns"] = ["52.174.55.168","188.165.200.156"]'
|
||||||
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[3]='.["dns-opts"] = []'
|
||||||
DOCKER_OPT[6]='.["exec-root"] = ""'
|
DOCKER_OPT[4]='.["dns-search"] = []'
|
||||||
DOCKER_OPT[7]='.["experimental"] = false'
|
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[8]='.["features"] = {}'
|
DOCKER_OPT[6]='.["exec-root"] = ""'
|
||||||
DOCKER_OPT[9]='.["storage-driver"] = "zfs"'
|
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[10]='.["storage-opts"] = ["zfs.fsname=rpool/docker"]'
|
||||||
DOCKER_OPT[11]='.["labels"] = []'
|
DOCKER_OPT[11]='.["labels"] = []'
|
||||||
DOCKER_OPT[12]='.["live-restore"] = ["true"]'
|
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"
|
JSON_FILE="daemon.json"
|
||||||
WORKDIR="/tmp"
|
WORKDIR="/tmp"
|
||||||
|
|
||||||
if [ ! -f ${WORKDIR}/${JSON_FILE} ]
|
if [ ! -f ${WORKDIR}/${JSON_FILE} ]; then
|
||||||
then
|
echo "{}" >${WORKDIR}/${JSON_FILE}
|
||||||
echo "{}" > ${WORKDIR}/${JSON_FILE}
|
|
||||||
else
|
else
|
||||||
echo "${WORKDIR}/${JSON_FILE} exists."
|
echo "${WORKDIR}/${JSON_FILE} exists."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Count through the number of array elements, using ${#
|
# Count through the number of array elements, using ${#
|
||||||
# looking for one missing.
|
# looking for one missing.
|
||||||
for ((i = 1; i < ${#DOCKER_OPT[@]}; ++i)); do
|
for ((i = 1; i < ${#DOCKER_OPT[@]}; ++i)); do
|
||||||
if [ -z "${DOCKER_OPT[$i]}" ]; then
|
if [ -z "${DOCKER_OPT[$i]}" ]; then
|
||||||
echo Error: $i missing.
|
echo Error: $i missing.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Work through each array element, using ${!.
|
# Work through each array element, using ${!.
|
||||||
# regardless how it's spelled.
|
# regardless how it's spelled.
|
||||||
for i in "${!DOCKER_OPT[@]}"; do
|
for i in "${!DOCKER_OPT[@]}"; do
|
||||||
OPTION="${DOCKER_OPT[$i]}"
|
OPTION="${DOCKER_OPT[$i]}"
|
||||||
jq "${OPTION}" ${WORKDIR}/${JSON_FILE} > ${WORKDIR}/${JSON_FILE}.new && \
|
jq "${OPTION}" ${WORKDIR}/${JSON_FILE} >${WORKDIR}/${JSON_FILE}.new &&
|
||||||
mv -b ${WORKDIR}/${JSON_FILE}.new ${WORKDIR}/${JSON_FILE}
|
mv -b ${WORKDIR}/${JSON_FILE}.new ${WORKDIR}/${JSON_FILE}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
cat ${WORKDIR}/${JSON_FILE} | jq
|
cat ${WORKDIR}/${JSON_FILE} | jq
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue