fields required :
docker_sock: path to your docker socketport_area_size: size of the port area for each docker (recommended 5000)base_image: id of the image you use by default to run a new docker container
Retrieve information about containers
- (optional multiple)
id: list of the container ids to get - (optional)
running: set to true to get only running container (overridden by id)
type : application/json
{
"error" : {
"[container_id]" : "[docker error message]",
...
}
"success" : {
"[container_id]" : {
"host_port_root": [root of port on host],
"name" : "[name]",
"dockerlink" : [version of dockerlink when the docker has been created or not_dockerlink]
"ports": {
"[port]/[tcp|udp]": {},
...
},
"state": "[running|exited|paused|restarting|removing|dead|created]
"exit_code" : [value if exited]
"started_at" : [unix timestamp if running]
},
...
}
}
creates a new container for HerbergOS usage (creates a volume on www/var)
(port 22,80 and 443 are forwarded by default)
json
{
"name" : [name of the container],
"host_port_root" : [number basis for port forwarding],
"memory" : [limit of memory in Go (can be decimal)],
"cpulimit" : [limit in number of cpu (can be decimal)],
"ports"(optional) : [
"[port]/[tcp|udp]",
...
]
"image"(optional) : [image id],
"commands"(optional) : [
[command to launch at start]
]
}
plain\text on error
application\json on success
{
"Id" : [id of the new container]
"warning" : [
[warnings coming from docker],
...
]
}
Delete a container by id
- id
plain\text
Update memory and cpulimit
- id
{
"cpulimit"(optional) : [limit in number of cpu (can be decimal)],
"memory"(optional): [limit in Go(can be decimal)],
}
Retrieve the timestamped stat of the container with id id since since
(returns stats even if the container is down (all stats to 0 even the memory and cpu limit))
id: the container id that you want to retrieve the statsince: Unix seconds timestamp (0 for all stats)
type : application\json
{
"[unix timestamp of the pull]" : {
"memory" : {
"used" : [amount of memory used in Go],
"limit" : [limit of memory of the container in Go]
},
"cpu" : {
"usage_percent" : [cpu usage in percent (100% = 1 core)]
"limit" : [cpu limit usage in percent (100% = 1 core) (can be NaN)]
},
"net" : {
"up" : [upload since launch in ko],
"down" : [download since launch in ko],
"delta_up": [upload since last pull (10 seconds) in ko],
"delta_down": [download since last pull (10 seconds) in ko],
}
},
...
}
Start the container of id id
id: the container id that you want to start
plain\text or no content
Stop the container of id id
id: the container id that you want to stop
plain\text or no content
restart the container of id id
id: the container id that you want to restart
plain\text or no content
execute git pull on the git local repository
id: id of the container- (optional)
path: indicates the path of the git repo
plain\text : git output
execute git init on the git local repository
id: id of the container- (optional)
path: indicates the path of the git repo
on error : plain\text
on success : no content
returns information about the git head
id: id of the container- (optional)
path: indicates the path of the git repo
plain\text : git output
fetch all the branch of a given directory if the directory is a git repository (distant branches are also fetched)
id: id of the container- (optional)
path: indicates the path of the git repo
plain\text on error,
application\json on success
[
"[branch 1]",
"[branch 2]",
...,
]
Get the name of the current branch
id: id of the container- (optional)
path: indicates the path of the git repo branch: name of the branch
plain\text : git output
Checkout to a new branch (if possible)
id: id of the container- (optional)
path: indicates the path of the git repo branch: name of the branch
plain\text : git output