A container is a representation of a Docker container on a host.
| Field | Type | Create | Update | Default | Notes |
|---|---|---|---|---|---|
| blkioDeviceOptions | map[blkioDeviceOption] | Optional | - | - | |
| blkioWeight | int | Optional | - | - | |
| build | dockerBuild | Optional | - | - | |
| capAdd | array[enum] | Optional | - | - | |
| capDrop | array[enum] | Optional | - | - | |
| cgroupParent | string | Optional | - | - | |
| command | array[string] | Optional | - | - | |
| count | int | Optional | - | - | |
| cpuCount | int | Optional | - | - | |
| cpuPercent | int | Optional | - | - | |
| cpuPeriod | int | Optional | - | - | |
| cpuQuota | int | Optional | - | - | |
| cpuSet | string | Optional | - | - | |
| cpuSetMems | string | Optional | - | - | |
| cpuShares | int | Optional | - | - | |
| dataVolumeMounts | map[volume] | Optional | - | - | |
| dataVolumes | array[string] | Optional | - | - | |
| dataVolumesFrom | array[container] | Optional | - | - | |
| description | string | Optional | Yes | - | |
| devices | array[string] | Optional | - | - | |
| diskQuota | int | Optional | - | - | |
| dns | array[string] | Optional | - | - | |
| dnsOpt | array[string] | Optional | - | - | |
| dnsSearch | array[string] | Optional | - | - | |
| domainName | string | Optional | - | - | |
| entryPoint | array[string] | Optional | - | - | |
| environment | map[string] | Optional | - | - | |
| expose | array[string] | Optional | - | - | |
| extraHosts | array[string] | Optional | - | - | |
| groupAdd | array[string] | Optional | - | - | |
| healthCheck | instanceHealthCheck | Optional | - | - | |
| healthCmd | array[string] | Optional | - | - | |
| healthInterval | int | Optional | - | - | |
| healthRetries | int | Optional | - | - | |
| healthTimeout | int | Optional | - | - | |
| hostname | string | Optional | - | - | |
| imageUuid | string | Optional | - | - | |
| instanceLinks | map[instance] | Optional | - | - | |
| instanceTriggeredStop | enum | Optional | - | stop | The options are stop, remove. |
| ioMaximumBandwidth | int | Optional | - | - | |
| ioMaximumIOps | int | Optional | - | - | |
| ip | string | Optional | - | - | |
| ip6 | string | Optional | - | - | |
| ipcMode | string | Optional | - | - | |
| isolation | string | Optional | - | - | |
| kernelMemory | int | Optional | - | - | |
| labels | map[string] | Optional | - | - | A map of key value pairs to be used as labels for the container |
| logConfig | logConfig | Optional | - | - | |
| lxcConf | map[string] | Optional | - | - | |
| memory | int | Optional | - | - | |
| memoryReservation | int | Optional | - | - | |
| memorySwap | int | Optional | - | - | |
| memorySwappiness | int | Optional | - | - | |
| milliCpuReservation | int | Optional | - | - | |
| name | string | Optional | Yes | - | |
| netAlias | array[string] | Optional | - | - | |
| networkContainerId | container | Optional | - | - | |
| networkIds | array[network] | Optional | - | - | |
| networkMode | string | Optional | - | managed | |
| oomKillDisable | boolean | Optional | - | - | |
| oomScoreAdj | int | Optional | - | - | |
| pidMode | enum | Optional | - | - | The options are host. |
| pidsLimit | int | Optional | - | - | |
| ports | array[string] | Optional | - | - | |
| privileged | boolean | Optional | - | - | |
| publishAllPorts | boolean | Optional | - | - | |
| readOnly | boolean | Optional | - | - | |
| registryCredentialId | registryCredential | Optional | - | - | |
| requestedHostId | host | Optional | - | - | |
| restartPolicy | restartPolicy | Optional | - | - | |
| secrets | array[secretReference] | Optional | - | - | |
| securityOpt | array[string] | Optional | - | - | |
| shmSize | int | Optional | - | - | |
| stackId | stack | Optional | - | - | |
| startOnCreate | boolean | Optional | - | true | |
| stdinOpen | boolean | Optional | - | - | |
| stopSignal | string | Optional | - | - | |
| storageOpt | map[string] | Optional | - | - | |
| sysctls | map[string] | Optional | - | - | |
| tmpfs | map[string] | Optional | - | - | |
| tty | boolean | Optional | - | - | |
| ulimits | array[ulimit] | Optional | - | - | |
| user | string | Optional | - | - | |
| usernsMode | string | Optional | - | - | |
| uts | string | Optional | - | - | |
| volumeDriver | string | Optional | - | - | |
| workingDir | string | Optional | - | - |
| Field | Type | Notes |
|---|---|---|
| agentId | agent | The unique identifier of the associated agent |
| allocationState | string | |
| createIndex | int | |
| data | map[json] | |
| deploymentUnitUuid | string | |
| externalId | string | |
| firstRunning | date | |
| healthState | enum | The options are healthy, unhealthy, updating-healthy, updating-unhealthy, initializing. |
| hostId | host | The unique identifier for the associated host |
| id | int | The unique identifier for the container |
| mounts | array[mountEntry] | |
| nativeContainer | boolean | |
| primaryIpAddress | string | |
| primaryNetworkId | network | |
| serviceId | service | The unique identifier of the associated service |
| serviceIds | array[service] | |
| startCount | int | |
| system | boolean | |
| token | string | |
| userPorts | array[string] | |
| version | string |
Please read more about the common resource fields. These fields are read only and applicable to almost every resource. We have segregated them from the list above.
/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=console
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=console'/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=execute
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"attachStdin": true,
"attachStdout": true,
"command": [
"string1",
"...stringN"
],
"tty": true
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=execute'/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=logs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"follow": true,
"lines": 100
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=logs'/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=proxy
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"port": 80,
"scheme": "http"
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=proxy'/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=restart
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=restart'/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=start
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=start'/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=stop
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"remove": false,
"timeout": 0
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/containers/${ID}?action=stop'