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.
| Flag | Name | Description |
|---|---|---|
| S | stopped | The container is stopped. |
| N | starting | The container is starting. |
| R | running | The container is running. |
| T | stopping | The container is stopping. |
| E | downloading/extracting | The image is being downloaded and extracted. |
| D | dynamic | The container is being deleted. |
| F | download/extract failed | Downloading or extracting the image failed. |
| C | starting-with-healthcheck | The container is starting and its healthcheck has not passed yet. |
| H | healthy | The healthcheck passes. |
| U | unhealthy | The healthcheck fails. |
| Argument | Type | Description |
|---|---|---|
| file | file | Image archive to create the container from, for example from podman save or /container/save. |
| remote-image | string | Image to download from the registry, for example pihole/pihole or nginx:alpine. The registry is set in /container/config. |
| ignore-remote-image-change | bool | |
| check-certificate | bool | Verifies the registry's HTTPS certificate when the image is downloaded. Default: yes. |
| name | string | Name of the container. |
| privileged | bool | |
| interface ( mandatory ) | multi { interface: iface_enum } | veth interface of the container (see veth). |
| env | object { 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. |
| envlists | multi { envlist: enum } | Lists of environment variables from /container/envs to use in the container. |
| labels | object { key-and-value: composite { key: string , value: string } } | |
| entrypoint | multi { cmd: string } | Executable that runs when the container starts, replacing the image's entrypoint. Example: /bin/sh. |
| cmd | multi { 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. |
| shell | multi { cmd: string } | Shell used to run commands in the container, replacing the image's default shell. |
| stop-signal | enum (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-time | time | Time limit for the container to stop gracefully before the stop signal is sent. Default: 10s. |
| root-dir | file | Directory where the container's files are stored. Use an attached disk rather than the built-in storage. |
| layer-dir | file | Directory for image layers that can be shared between containers. |
| mount | object { 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. |
| tmpfs | object { 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. |
| mountlists | multi { mountlist: enum } | Lists of mounts from /container/mounts to use in the container. |
| shm-size | num | Size of the /dev/shm shared memory file system in the container. Default: 64MiB. |
| dns | multi { dns-server-ip: address (flags=46) } | DNS servers for the container. Without it, the container uses the router's DNS servers (default-dns). |
| default-dns | multi { dns-server-ip: address (flags=46) } | DNS servers taken from the router's /ip/dns configuration. |
| hostname | string | Host name of the container. |
| domain-name | string | Domain name of the container. |
| workdir | string | Working directory for the entrypoint and command. |
| logging | bool | Writes the container's output to the RouterOS log (topic container). Default: no. |
| start-on-boot | bool | Starts the container when the router starts. Default: no. |
| stop-on-unhealthy | bool | If set to yes, the container is stopped when the healthcheck status becomes unhealthy. Default: no. |
| restart-policy | enum (no | on-failure | always) | When the router restarts the container:
|
| restart-max-count | num | Maximum number of restart attempts within restart-interval. Default: 0. |
| restart-interval | time | Time frame for restart-max-count. Default: 0s. |
| user | string | User and group the container process runs as, for example 0:0. |
| cpu-list | multi { cpu: enum } | CPU cores the container may run on. |
| memory-high | num | Soft 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-max | num | Hard 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-max | num | Maximum swap space in bytes for the container. Requires swap on the router (see Swap space). Default: unlimited. |
| devices | object { dst-size-mode: composite { device: enum , container-dev-name: string } } | Router devices passed through to the container, for example devices=serial0:"". |
| hosts | object { host-entry: composite { host-name: string , host-addr: address (flags=46) } } | Host name to address entries for the container. Format: host=ip. |
| healthcheck-cmd | multi { 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-interval | time | Time between healthchecks. Image default or 30s. |
| healthcheck-timeout | time | A check that takes longer counts as failed. Image default or 30s. |
| healthcheck-start-period | time | Time after the start during which failed checks are not counted. Image default or 0s. |
| healthcheck-start-interval | time | Time between checks during the start period. Image default or 5s. |
| healthcheck-retries | num | Failed checks in a row before the container is unhealthy. Image default or 3. |
| healthcheck-status | string | Result of the last healthcheck and the command's output, for example good, output:. |
| Read-only Argument | Type | Description |
|---|---|---|
| tag | string | Full image reference, for example registry-1.docker.io/library/nginx:alpine. |
| os | string | Operating system of the image. |
| arch | string | Architecture of the image, for example amd64. |
| env-current | object { key-and-value: composite { key: string , value: string } } | Environment variables of the running container: from the image, env and envlists. |
| image-labels | object { key-and-value: composite { key: string , value: string } } | |
| default-entrypoint | string | Entrypoint defined in the image. |
| default-cmd | string | Command defined in the image. |
| default-shell | string | Shell defined in the image, for example /bin/sh -c. |
| default-stop-signal | enum (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-workdir | string | Working directory defined in the image. |
| restart-count | num | Number of restarts done by restart-policy. |
| default-user | string | User defined in the image. |
| memory-current | num | Memory the container uses now. |
| swap-current | num | Swap the container uses now. |
| cpu-usage | num | CPU usage of the container. |
| container-size | num | Size of the container's files. |
| data-size | num | Size of the container's data. |
| image-id | string | Identifier of the image. |
| config-json | string | |
| layers | multi { layer: enum } | Image layers used by the container (see /container/layers). |
| default-healthcheck-cmd | multi { default-healthcheck-cmd: string } | Healthcheck command defined in the image. |
| default-healthcheck-interval | time | Healthcheck interval defined in the image, or 30s. |
| default-healthcheck-timeout | time | Healthcheck timeout defined in the image, or 30s. |
| default-healthcheck-start-period | time | Healthcheck start period defined in the image, or 0s. |
| default-healthcheck-start-interval | time | Healthcheck start interval defined in the image, or 5s. |
| default-healthcheck-retries | num | Healthcheck retries defined in the image, or 3. |
| check-update-result | enum (none | checking | up-to-date | update-available) |