improve the guide's docker script

This addresses the `"docker run" requires at least 1 argument.` error
described in #205 and clarifies some comments.
This commit is contained in:
Scott Lamb 2022-03-16 12:47:00 -07:00
parent ae8fbaff83
commit f18b58613c

View File

@ -85,7 +85,7 @@ own_uid_is_privileged = true
# Set your timezone here. # Set your timezone here.
tz="America/Los_Angeles" tz="America/Los_Angeles"
# or eg "scottlamb/moonfire-nvr:v0.7.1" to specify a particular version. # or e.g. "scottlamb/moonfire-nvr:v0.7.1" to specify a particular version.
image_name="scottlamb/moonfire-nvr:latest" image_name="scottlamb/moonfire-nvr:latest"
container_name="moonfire-nvr" container_name="moonfire-nvr"
common_docker_run_args=( common_docker_run_args=(
@ -93,14 +93,20 @@ common_docker_run_args=(
--mount=type=bind,source=/etc/moonfire-nvr.toml,destination=/etc/moonfire-nvr.toml --mount=type=bind,source=/etc/moonfire-nvr.toml,destination=/etc/moonfire-nvr.toml
# Add additional mount lines here for each sample file directory # Add additional mount lines here for each sample file directory
# outside of /var/lib/moonfire-nvr, eg: # outside of /var/lib/moonfire-nvr, e.g.:
# --mount=type=bind,source=/media/nvr/sample,destination=/media/nvr/sample # --mount=type=bind,source=/media/nvr/sample,destination=/media/nvr/sample
--user="$(id -u moonfire-nvr):$(id -g moonfire-nvr)" --user="$(id -u moonfire-nvr):$(id -g moonfire-nvr)"
# This avoids errors with broken seccomp on Raspberry Pi OS. # This avoids errors with broken seccomp on older 32-bit hosts.
# https://github.com/moby/moby/issues/40734
--security-opt=seccomp:unconfined --security-opt=seccomp:unconfined
# This is the simplest way of configuring networking, although
# you can use e.g. --publish=8080:8080 in the run) case below if you
# prefer.
--network=host
# docker's default log driver won't rotate logs properly, and will throw # docker's default log driver won't rotate logs properly, and will throw
# away logs when you destroy and recreate the container. Using journald # away logs when you destroy and recreate the container. Using journald
# solves these problems. # solves these problems.
@ -119,11 +125,6 @@ run)
--detach=true \ --detach=true \
--restart=unless-stopped \ --restart=unless-stopped \
"${common_docker_run_args[@]}" \ "${common_docker_run_args[@]}" \
# This is the simplest way of configuring networking, although
# you can use eg --publish=8080:8080 if you prefer.
--network=host \
--name="${container_name}" \ --name="${container_name}" \
"${image_name}" \ "${image_name}" \
run \ run \