If you’re looking to run docker images as daemon processes, or interactively, below are some command-line parameters I’ve found useful when using docker run
command:
-d
- runs the image as a daemon, not interactive--restart=always
- tells docker to always restart this image if the host is rebooted-p (internal port):(external port)
- tells docker which TCP ports to expose via the host’s network--mount type=tmpfs,destination=/path
- tells docker to mount a temporary filesystem, specifying the path inside the image to /path-
-e TZ=Australia/Melbourne
- adds an environment variable “TZ” with a value of “Australia/Melbourne”Side note: when running the Azure Functions runtime on a Linux host, the environment variable
TZ
can be set with a value from the tz database - this Wikipedia article lists all available tz values in the TZ database name column.Second side note: The environment variable to disable an Azure Functions Timer trigger function is: -e
AzureWebJobs.TimerFunctionName.Disabled=1
--privileged
enables privileged access from the image to the host OS - this is useful if the container needs to mount a CIFs / SMB / Windows share-v /external/host/path:/internal/path
- mounts a directory from the host to be available inside the image-
--log-driver=journald
- sends the log output that normally goes to stdout whendocker run
is executed with the-i
interactive flagSide note: once the daemon image is running with
--log-drive=journald
use the following command to tail the output:journalctl CONTAINER_NAME=image-name -f
--name image-name
specifies the name of the image which can be used in subsequentdocker stop
anddocker rm
commands