Container

A container is a representation of a Docker container on a host.

Resource Fields

Writeable Fields

Field Type Create Update Default Notes
blkioDeviceOptions map[blkioDeviceOption] Optional - -  
build dockerBuild Optional - -  
capAdd array[enum] Optional - -  
capDrop array[enum] Optional - -  
command array[string] Optional - -  
count int Optional - -  
cpuSet 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 - -  
dns 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 - -  
healthCheck instanceHealthCheck Optional - -  
hostname string Optional - -  
imageUuid string Optional - -  
instanceLinks map[instance] 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 - -  
memorySwap int Optional - -  
name string Optional Yes -  
networkContainerId container Optional - -  
networkIds array[network] Optional - -  
networkMode enum Optional - managed The options are none, bridge, host, managed, container.
pidMode enum Optional - - The options are host.
ports array[string] Optional - -  
privileged boolean Optional - -  
publishAllPorts boolean Optional - -  
readOnly boolean Optional - -  
registryCredentialId registryCredential Optional - -  
requestedHostId host Optional - -  
restartPolicy restartPolicy Optional - -  
securityOpt array[string] Optional - -  
startOnCreate boolean Optional - true  
stdinOpen boolean Optional - -  
tty boolean Optional - -  
user string Optional - -  
volumeDriver string Optional - -  
workingDir string Optional - -  

Read Only Fields

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
nativeContainer boolean  
primaryIpAddress string  
startCount int  
systemContainer enum The options are NetworkAgent, LoadBalancerAgent.
token 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.

Actions

console POST: /v1/projects/${PROJECT_ID}/containers/${ID}?action=console

Input: InstanceConsoleInput
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/containers/${ID}?action=console'

Output: An updated copy of the instanceConsole resource
execute POST: /v1/projects/${PROJECT_ID}/containers/${ID}?action=execute

Input: ContainerExec Field | Type | Required | Default | Notes ---|---|---|---|--- attachStdin | | No | true | attachStdout | | No | true | command | array[string] | Yes | | tty | | No | true |
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/v1/projects/${PROJECT_ID}/containers/${ID}?action=execute'

Output: An updated copy of the hostAccess resource
logs POST: /v1/projects/${PROJECT_ID}/containers/${ID}?action=logs

Input: ContainerLogs Field | Type | Required | Default | Notes ---|---|---|---|--- follow | | No | true | lines | | No | 100 |
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
	"follow": true,
	"lines": 100
}' 'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/containers/${ID}?action=logs'

Output: An updated copy of the hostAccess resource
proxy POST: /v1/projects/${PROJECT_ID}/containers/${ID}?action=proxy

Input: ContainerProxy Field | Type | Required | Default | Notes ---|---|---|---|--- port | | No | 80 | scheme | | No | http | The options are `http`, `https`.
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
	"port": 80,
	"scheme": "http"
}' 'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/containers/${ID}?action=proxy'

Output: An updated copy of the hostAccess resource
restart POST: /v1/projects/${PROJECT_ID}/containers/${ID}?action=restart

Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/containers/${ID}?action=restart'

Output: An updated copy of the instance resource
start POST: /v1/projects/${PROJECT_ID}/containers/${ID}?action=start

Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/containers/${ID}?action=start'

Output: An updated copy of the instance resource
stop POST: /v1/projects/${PROJECT_ID}/containers/${ID}?action=stop

Input: InstanceStop Field | Type | Required | Default | Notes ---|---|---|---|--- remove | | No | | timeout | | No | |
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
	"remove": false,
	"timeout": 0
}' 'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/containers/${ID}?action=stop'

Output: An updated copy of the instance resource
Edit this page