Appendix: Container Configuration
This section describes the properties of container configuration.
Properties
The following properties of container configuration file are supported in the expected JSON format:
Below are the supported properties in the JSON:
- pod_sandbox_id <string, REQUIRED>
- The ID of an existing pod sandbox to create this container under. The pod sandbox must already be created.
- config <object, REQUIRED>
- Configuration for creating the container.
Sample Configurations
View the following examples of various container configurations.
- Minimal configuration
-
{ "pod_sandbox_id": "581dab1756f70b116570fe4a69b41205d74c6eb8534eff88bcec8641ef16cacd", "config": { "metadata": { "name": "container1" }, "image": { "image": "<aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/hello-container:v0" }, "qnx": { "security_context": { "run_as_user": 1000, "run_as_group": 1000 } } } } - Simple configuration for starting a user app
-
{ "pod_sandbox_id": "16786af2a967444036f0b394e833e2fddfd865006b77635afa58dfc97678dc32", "config": { "metadata": { "name": "container2" }, "image": { "image": "<aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/my-base-image:v0" }, "working_dir": "/usr/bin", "command": [ "./my-app" ], "args": [ "-i", "20" ], "envs": [ { "key": "ENV_1", "value": "VAL_1" }, { "key": "ENV_2", "value": "VAL_2" } ], "mounts": [ { "container_path": "/myroot", "host_path": "/data/home/root" } ], "qnx": { "security_context": { "run_as_user": 1000, "run_as_group": 1000 } } } } - Full configuration example with all options set
-
{ "pod_sandbox_id": "c6c853cce5df47816c3ae3fc2ecfb23e0493226c099e1b30447fb70f808a8e99/", "config": { [ "metadata": { "name": "container3" }, "image": { "image": "989677723404.dkr.ecr.us-east-1.amazonaws.com/my-base-image:v1" }, "working_dir": "/", "command": [ "/bin/tail" ], "args": [ "-F", "/dev/null" ], "envs": [ { "key": "ENV_1", "value": "VAL_1" }, { "key": "ENV_2", "value": "VAL_2" } ], "mounts": [ { "container_path": "/mydata", "host_path": "/data/home/root/cont3_data" }, { "container_path": "/dev/null", "host_path": "/dev/null" }, { "container_path": "/dev/socket", "host_path": "/dev/socket" }, { "container_path": "/dev/random", "host_path": "/dev/random" } ], ], "annotations": { "com.example.gpu-cores": "2" }, "stop_signal": 13, "log_path": "container3/log.txt", "qnx": { "resources": { "rlimits": [ { "type": "RLIMIT_CPU", "soft": "10", "hard": "100" }, { "type": "RLIMIT_NPROC", "soft": "10", "hard": "20" } ], "cpu_cluster": "_all" }, "security_context": { "run_as_user": 101, "run_as_group": 101, "secpol_type": "type1" }, "hooks": { "createRuntime": [ { "path": "/etc/scripts/data-setup.sh", "env": [ "ARG1=VAL1", "ARG2=VAL2" ] } ], "createContainer": [ { "path": "chown", "args": [ "-R", "/data/home/root/cont3_data", "101:101" ] } ], "startContainer": [ { "path": "/setup_paths.sh" } ], "postStart": [ { "path": "/etc/scripts/upstream-notify.sh", "args": [ "--endpoint", "test_server" ], "env": [ "ARG3=VAL3" ], "timeout": 5 } ], "postStop": [ { "path": "/etc/scripts/data-backup.sh" }, { "path": "/etc/scripts/data-flush.sh" } ] } } } }
Page updated:
