Container configuration

Customize the deployment of a container instance.

Properties

To control all aspects of the container instance behavior.

PropertyTypeDefaultDescription
container_namestring<container_id>User-defined name for the container, if omitted the internally auto-generated container ID will be set
Image
namestringFully qualified image reference, that follows the OCI Image Specification, the format is: host[:port]/[namespace/]name:tag
Image - decryption
keysstring[]Private keys (GPG private key ring, JWE or PKCS7) used for decrypting the container’s image, the format is: filepath_private_key[:password]
recipientsstring[]Recipients (only for PKCS7 and must be an x509) used for decrypting the container’s image, the format is: pkcs7:filepath_x509_certificate
Networking
domain_namestring<container_name>-domainDomain name inside the container, if omitted the container_name with suffix -domain will be set
host_namestring<container_name>-hostHost name for the container, if omitted the container_name with suffix -host will be set
network_modestringbridgeThe container’s networking capabilities type based on the desired communication mode, the possible options are: bridge or host
extra_hostsstring[]Extra host name to IP address mappings added to the container network configuration, the format is: hostname:ip. If the IP of the host machine is to be added to the container’s hosts file the reserved host_ip[_<network-interface>] must be provided. If only host_ip (the network-interface part is skipped) is used, by default it will be resolved to the host’s IP on the default bridge network interface for containerm (the default configuration is kanto-cm0) and add it to the container’s hosts file. If the IP of a container in the same bridge network is to be added to the hosts file the reserved container_<container-host_name> must be provided.
Networking - port mappings
protostringtcpProtocol used for the port mapping from the container to the host, the possible options are: tcp and udp
container_portintPort number on the container that is mapped to the host port
host_ipstring0.0.0.0Host IP address
host_portintBeginning of the host ports range
host_port_endint<host_port>Ending of the host ports range
Host resources - devices
path_on_hoststringPath to the device on the host
path_in_containerstringPath to the device in the container
cgroup_permissionsstringrwmCgroup permissions for the device access, possible options are: r(read), w(write), m(mknod) and all combinations are possible
privilegedboolfalseGrant root capabilities to all devices on the host system
Host resources - mount points
sourcestringPath to the file or directory on the host that is referred from within the container
destinationstringPath to the file or directory that is mounted inside the container
propagation_modestringrprivateBind propagation for the mount, supported are: rprivate, private, rshared, shared, rslave or slave
Process
envstring[]Environment variables that are set into the container
cmdstring[]Command with arguments that is executed upon the container’s start
I/O
open_stdinboolOpen the terminal’s standard input for an interaction with the current container
ttyboolAttach standard streams to a TTY
Resource management
memorystringHard memory limitation of the container as a number with a unit suffix of B, K, M and G, the minimum allowed value is 3M
memory_reservationstringSoft memory limitation of the container as a number with a unit suffix of B, K, M and G, if memory is specified, the memory_reservation must be smaller than it
memory_swapstringTotal amount of memory and swap that the container can use as a number with a unit suffix of B, K, M and G, use -1 to allow the container to use unlimited swap
Lifecycle
typestringunless-stoppedThe container’s restart policy, the supported types are: always, no, on-failure and unless-stopped
maximum_retry_countintMaximum number of retries that are made to restart the container on exit with fail, if the type is on-failure
retry_timeoutintTimeout period in seconds for each retry that is made to restart the container on exit with fail, if the type is on-failure
Logging
typestringjson-fileType in which the logs are produced, the possible options are: json-file or none
max_filesint2Maximum log files before getting rotated
max_sizestring100MMaximum log file size before getting rotated as a number with a unit suffix of B, K, M and G
root_dirstring<meta_path>/containers/<container_id>Root directory where the container’s log messages are stored
modestringblockingMessaging delivery mode from the container to the log driver, the supported modes are: blocking and non-blocking
max_buffer_sizestring1MMaximum size of the buffered container’s log messages in a non-blocking mode as a number with a unit suffix of B, K, M and G

Example

The minimal required configuration to spin up an InfluxDB container instance.

{
  "image": {
    "name": "docker.io/library/influxdb:1.8.4"
  }
}

Template

The configuration can be further adjusted according to the use case. The following template illustrates all possible properties with their default values.

{
    "container_name": "",
    "image": {
        "name": "",
        "decrypt_config": {
            "keys": [],
            "recipients": []
        }
    },
    "domain_name": "",
    "host_name": "",
    "mount_points": [
        {
            "destination": "",
            "source": "",
            "propagation_mode": "rprivate"
        }
    ],
    "config": {
        "env": [],
        "cmd": []
    },
    "io_config": {
        "open_stdin": false,
        "tty": false
    },
    "host_config": {
        "devices": [
            {
                "path_on_host": "",
                "path_in_container": "",
                "cgroup_permissions": "rwm"
            }
        ],
        "network_mode": "bridge",
        "privileged": false,
        "extra_hosts": [],
        "port_mappings": [
            {
                "proto": "tcp",
                "container_port": 0,
                "host_ip": "0.0.0.0",
                "host_port": 0,
                "host_port_end": 0
            }
        ],
        "resources": {
            "memory": "",
            "memory_reservation": "",
            "memory_swap": ""
        },
        "restart_policy": {
            "type": "unless-stopped",
            "maximum_retry_count": 0,
            "retry_timeout": 0
        },
        "log_config": {
            "driver_config": {
                "type": "json-file",
                "max_files": 2,
                "max_size": "100M",
                "root_dir": ""
            },
            "mode_config": {
                "mode": "blocking",
                "max_buffer_size": "1M"
            }
        }
    }
}
Last modified September 1, 2023