Create a container
/v1.33
/v1.33
/v1.33
/v1.33
POST
/containers/create
Container
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/v1.33/containers/create' \
--header 'Content-Type: application/json' \
--data-raw '{
"AttachStderr": true,
"AttachStdin": false,
"AttachStdout": true,
"Cmd": [
"date"
],
"Domainname": "",
"Entrypoint": "",
"Env": [
"FOO=bar",
"BAZ=quux"
],
"ExposedPorts": {
"22/tcp": {}
},
"HostConfig": {
"AutoRemove": true,
"Binds": [
"/tmp:/tmp"
],
"BlkioDeviceReadBps": [
{}
],
"BlkioDeviceReadIOps": [
{}
],
"BlkioDeviceWriteBps": [
{}
],
"BlkioDeviceWriteIOps": [
{}
],
"BlkioWeight": 300,
"BlkioWeightDevice": [
{}
],
"CapAdd": [
"NET_ADMIN"
],
"CapDrop": [
"MKNOD"
],
"CgroupParent": "",
"CpuPercent": 80,
"CpuPeriod": 100000,
"CpuQuota": 50000,
"CpuRealtimePeriod": 1000000,
"CpuRealtimeRuntime": 10000,
"CpuShares": 512,
"CpusetCpus": "0,1",
"CpusetMems": "0,1",
"Devices": [],
"Dns": [
"8.8.8.8"
],
"DnsOptions": [
""
],
"DnsSearch": [
""
],
"GroupAdd": [
"newgroup"
],
"KernelMemory": 0,
"Links": [
"redis3:redis"
],
"LogConfig": {
"Config": {},
"Type": "json-file"
},
"MaximumIOBps": 0,
"MaximumIOps": 0,
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": 60,
"NanoCPUs": 500000,
"NetworkMode": "bridge",
"OomKillDisable": false,
"OomScoreAdj": 500,
"PidMode": "",
"PidsLimit": -1,
"PortBindings": {
"22/tcp": [
{
"HostPort": "11022"
}
]
},
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"RestartPolicy": {
"MaximumRetryCount": 0,
"Name": ""
},
"SecurityOpt": [],
"ShmSize": 67108864,
"StorageOpt": {},
"Ulimits": [
{}
],
"VolumeDriver": "",
"VolumesFrom": [
"parent",
"other:ro"
]
},
"Hostname": "",
"Image": "ubuntu",
"Labels": {
"com.example.license": "GPL",
"com.example.vendor": "Acme",
"com.example.version": "1.0"
},
"MacAddress": "12:34:56:78:9a:bc",
"NetworkDisabled": false,
"NetworkingConfig": {
"EndpointsConfig": {
"isolated_nw": {
"Aliases": [
"server_x",
"server_y"
],
"IPAMConfig": {
"IPv4Address": "172.20.30.33",
"IPv6Address": "2001:db8:abcd::3033",
"LinkLocalIPs": [
"169.254.34.68",
"fe80::3468"
]
},
"Links": [
"container_1",
"container_2"
]
}
}
},
"OpenStdin": false,
"StdinOnce": false,
"StopSignal": "SIGTERM",
"StopTimeout": 10,
"Tty": false,
"User": "",
"Volumes": {
"/volumes/data": {}
},
"WorkingDir": ""
}'
Response Response Example
201 - response
{
"Id": "e90e34656806",
"Warnings": []
}
Request
Query Params
name
stringÂ
optional
/?[a-zA-Z0-9_-]+
.Body Params application/json
Responses
Modified at 2022-09-10 17:56:06