Skip to main content
Version: 7.26

container


container​

Package: container
Type: Directory

Containers run Linux container images (OCI) on the router. The container package must be installed and the container feature enabled in device-mode. See Container.

FlagNameDescription
SstoppedThe container is stopped.
NstartingThe container is starting.
RrunningThe container is running.
TstoppingThe container is stopping.
Edownloading/extractingThe image is being downloaded and extracted.
DdynamicThe container is being deleted.
Fdownload/extract failedDownloading or extracting the image failed.
Cstarting-with-healthcheckThe container is starting and its healthcheck has not passed yet.
HhealthyThe healthcheck passes.
UunhealthyThe healthcheck fails.
ArgumentTypeDescription
filefileImage archive to create the container from, for example from podman save or /container/save.
remote-imagestringImage to download from the registry, for example pihole/pihole or nginx:alpine. The registry is set in /container/config.
ignore-remote-image-changebool
check-certificateboolVerifies the registry's HTTPS certificate when the image is downloaded. Default: yes.
namestringName of the container.
privilegedbool
interface ( mandatory )multi { interface: iface_enum }veth interface of the container (see veth).
envobject { key-and-value-element: super { ! , key-and-value: composite { key: string , value: string } } }Environment variables set directly on the container, for example env=FOO=1,BAR=2.
envlistsmulti { envlist: enum }Lists of environment variables from /container/envs to use in the container.
labelsobject { key-and-value: composite { key: string , value: string } }
entrypointmulti { cmd: string }Executable that runs when the container starts, replacing the image's entrypoint. Example: /bin/sh.
cmdmulti { cmd: string }Arguments for the entrypoint, or the command to run, replacing the image's default command. A list: when it has several items, separated by commas, each item is passed as one argument, spaces included (cmd="-c,print('hello world')" passes two arguments). A single item is split into arguments at spaces, and single quotes keep words together (cmd="-c 'b c'" passes -c and b c). Double quotes inside the value also separate items, so the text between them stays one argument, spaces included; to pass arguments with spaces, use commas.
shellmulti { cmd: string }Shell used to run commands in the container, replacing the image's default shell.
stop-signalenum (1-SIGHUP | 2-SIGINT | 3-SIGQUIT | 4-SIGILL | 5-SIGTRAP | 6-SIGABTR | 7-SIGBUS | 8-SIGFPE | 9-SIGKILL | 10-SIGUSR1 | 11-SIGSEGV | 12-SIGUSR2 | 13-SIGPIPE | 14-SIGALRM | 15-SIGTERM | 16-SIGSTKFLT | 17-SIGCHLD | 18-SIGCONT | 19-SIGSTOP | 20-SIGTSTP | 21-SIGTTIN | 22-SIGTTOU | 23-SIGURG | 24-SIGXCPU | 25-SIGXFSZ | 26-SIGVTALRM | 27-SIGPROF | 28-SIGWINCH | 29-SIGIO | 30-SIGPWR | 31-SIGSYS) { 1-SIGHUP:1, 2-SIGINT:2, 3-SIGQUIT:3, 4-SIGILL:4, 5-SIGTRAP:5, 6-SIGABTR:6, 7-SIGBUS:7, 8-SIGFPE:8, 9-SIGKILL:9, 10-SIGUSR1:10, 11-SIGSEGV:11, 12-SIGUSR2:12, 13-SIGPIPE:13, 14-SIGALRM:14, 15-SIGTERM:15, 16-SIGSTKFLT:16, 17-SIGCHLD:17, 18-SIGCONT:18, 19-SIGSTOP:19, 20-SIGTSTP:20, 21-SIGTTIN:21, 22-SIGTTOU:22, 23-SIGURG:23, 24-SIGXCPU:24, 25-SIGXFSZ:25, 26-SIGVTALRM:26, 27-SIGPROF:27, 28-SIGWINCH:28, 29-SIGIO:29, 30-SIGPWR:30, 31-SIGSYS:31 }Linux signal sent to stop the container. Without it, the image's default stop signal is used (default-stop-signal).
stop-timetimeTime limit for the container to stop gracefully before the stop signal is sent. Default: 10s.
root-dirfileDirectory where the container's files are stored. Use an attached disk rather than the built-in storage.
layer-dirfileDirectory for image layers that can be shared between containers.
mountobject { src-dst-mode: composite { src: file , dst-mode: composite { dst: string , mode: enum (rw | ro | rw,noexec | ro,noexec) } } }Mount defined directly on the container, as source on the router and destination in the container.
tmpfsobject { dst-size-mode: composite { dst: string , size-mode: composite { size: num , mode: string } } }Temporary file system mount points in the container. Format: size@dir, for example 64M@/tmp.
mountlistsmulti { mountlist: enum }Lists of mounts from /container/mounts to use in the container.
shm-sizenumSize of the /dev/shm shared memory file system in the container. Default: 64MiB.
dnsmulti { dns-server-ip: address (flags=46) }DNS servers for the container. Without it, the container uses the router's DNS servers (default-dns).
default-dnsmulti { dns-server-ip: address (flags=46) }DNS servers taken from the router's /ip/dns configuration.
hostnamestringHost name of the container.
domain-namestringDomain name of the container.
workdirstringWorking directory for the entrypoint and command.
loggingboolWrites the container's output to the RouterOS log (topic container). Default: no.
start-on-bootboolStarts the container when the router starts. Default: no.
stop-on-unhealthyboolIf set to yes, the container is stopped when the healthcheck status becomes unhealthy. Default: no.
restart-policyenum (no | on-failure | always)

When the router restarts the container:

  • no (default) - never.
  • on-failure - when it exits with a non-zero code.
  • always - always restart.
restart-max-countnumMaximum number of restart attempts within restart-interval. Default: 0.
restart-intervaltimeTime frame for restart-max-count. Default: 0s.
userstringUser and group the container process runs as, for example 0:0.
cpu-listmulti { cpu: enum }CPU cores the container may run on.
memory-highnumSoft memory limit in bytes: above it, the container's processes are throttled and put under memory reclaim pressure. If both this and the global value are set, the lower one applies. Default: unlimited.
memory-maxnumHard memory limit in bytes. A container that exceeds it is killed; /container/print then shows the comment killed due to out of memory. Values below 1 MB are refused. If both this and the global value in /container/config are set, the lower one applies. Default: unlimited.
swap-maxnumMaximum swap space in bytes for the container. Requires swap on the router (see Swap space). Default: unlimited.
devicesobject { dst-size-mode: composite { device: enum , container-dev-name: string } }Router devices passed through to the container, for example devices=serial0:"".
hostsobject { host-entry: composite { host-name: string , host-addr: address (flags=46) } }Host name to address entries for the container. Format: host=ip.
healthcheck-cmdmulti { healthcheck-cmd: string }Command that checks the container's application; exit code 0 means healthy. Without it, the image's healthcheck is used (default-healthcheck-cmd).
healthcheck-intervaltimeTime between healthchecks. Image default or 30s.
healthcheck-timeouttimeA check that takes longer counts as failed. Image default or 30s.
healthcheck-start-periodtimeTime after the start during which failed checks are not counted. Image default or 0s.
healthcheck-start-intervaltimeTime between checks during the start period. Image default or 5s.
healthcheck-retriesnumFailed checks in a row before the container is unhealthy. Image default or 3.
healthcheck-statusstringResult of the last healthcheck and the command's output, for example good, output:.
Read-only ArgumentTypeDescription
tagstringFull image reference, for example registry-1.docker.io/library/nginx:alpine.
osstringOperating system of the image.
archstringArchitecture of the image, for example amd64.
env-currentobject { key-and-value: composite { key: string , value: string } }Environment variables of the running container: from the image, env and envlists.
image-labelsobject { key-and-value: composite { key: string , value: string } }
default-entrypointstringEntrypoint defined in the image.
default-cmdstringCommand defined in the image.
default-shellstringShell defined in the image, for example /bin/sh -c.
default-stop-signalenum (1-SIGHUP | 2-SIGINT | 3-SIGQUIT | 4-SIGILL | 5-SIGTRAP | 6-SIGABTR | 7-SIGBUS | 8-SIGFPE | 9-SIGKILL | 10-SIGUSR1 | 11-SIGSEGV | 12-SIGUSR2 | 13-SIGPIPE | 14-SIGALRM | 15-SIGTERM | 16-SIGSTKFLT | 17-SIGCHLD | 18-SIGCONT | 19-SIGSTOP | 20-SIGTSTP | 21-SIGTTIN | 22-SIGTTOU | 23-SIGURG | 24-SIGXCPU | 25-SIGXFSZ | 26-SIGVTALRM | 27-SIGPROF | 28-SIGWINCH | 29-SIGIO | 30-SIGPWR | 31-SIGSYS) { 1-SIGHUP:1, 2-SIGINT:2, 3-SIGQUIT:3, 4-SIGILL:4, 5-SIGTRAP:5, 6-SIGABTR:6, 7-SIGBUS:7, 8-SIGFPE:8, 9-SIGKILL:9, 10-SIGUSR1:10, 11-SIGSEGV:11, 12-SIGUSR2:12, 13-SIGPIPE:13, 14-SIGALRM:14, 15-SIGTERM:15, 16-SIGSTKFLT:16, 17-SIGCHLD:17, 18-SIGCONT:18, 19-SIGSTOP:19, 20-SIGTSTP:20, 21-SIGTTIN:21, 22-SIGTTOU:22, 23-SIGURG:23, 24-SIGXCPU:24, 25-SIGXFSZ:25, 26-SIGVTALRM:26, 27-SIGPROF:27, 28-SIGWINCH:28, 29-SIGIO:29, 30-SIGPWR:30, 31-SIGSYS:31 }Stop signal defined in the image.
default-workdirstringWorking directory defined in the image.
restart-countnumNumber of restarts done by restart-policy.
default-userstringUser defined in the image.
memory-currentnumMemory the container uses now.
swap-currentnumSwap the container uses now.
cpu-usagenumCPU usage of the container.
container-sizenumSize of the container's files.
data-sizenumSize of the container's data.
image-idstringIdentifier of the image.
config-jsonstring
layersmulti { layer: enum }Image layers used by the container (see /container/layers).
default-healthcheck-cmdmulti { default-healthcheck-cmd: string }Healthcheck command defined in the image.
default-healthcheck-intervaltimeHealthcheck interval defined in the image, or 30s.
default-healthcheck-timeouttimeHealthcheck timeout defined in the image, or 30s.
default-healthcheck-start-periodtimeHealthcheck start period defined in the image, or 0s.
default-healthcheck-start-intervaltimeHealthcheck start interval defined in the image, or 5s.
default-healthcheck-retriesnumHealthcheck retries defined in the image, or 3.
check-update-resultenum (none | checking | up-to-date | update-available)