Skip to content

Commit

Permalink
docs: auto generate pouch cli docs via code
Browse files Browse the repository at this point in the history
Signed-off-by: pouchrobot <pouch-dev@list.alibaba-inc.com>
  • Loading branch information
pouchrobot authored and allencloud committed Oct 18, 2018
1 parent 221e842 commit b2542f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 106 deletions.
45 changes: 7 additions & 38 deletions docs/api/HTTP_API.md
Expand Up @@ -2327,48 +2327,17 @@ container stats almost from cgroup resource usage.

<a name="containerupgradeconfig"></a>
### ContainerUpgradeConfig
ContainerUpgradeConfig is used for API "POST /containers/upgrade".
It wraps all kinds of config used in container upgrade.
It can be used to encode client params in client and unmarshal request body in daemon side.

*Polymorphism* : Composition
ContainerUpgradeConfig is used for API "POST /containers/{name:.*}/upgrade". when upgrade a container,
we must specify new image used to create a new container, and also can specify `Cmd` and `Entrypoint` for
new container. There is all parameters that upgrade a container, if want to change other parameters, i
think you should use `update` API interface.


|Name|Description|Schema|
|---|---|---|
|**ArgsEscaped** <br>*optional*|Command is already escaped (Windows only)|boolean|
|**AttachStderr** <br>*optional*|Whether to attach to `stderr`. <br>**Default** : `true`|boolean|
|**AttachStdin** <br>*optional*|Whether to attach to `stdin`.|boolean|
|**AttachStdout** <br>*optional*|Whether to attach to `stdout`. <br>**Default** : `true`|boolean|
|**Cmd** <br>*optional*|Command to run specified an array of strings.|< string > array|
|**DisableNetworkFiles** <br>*optional*|Whether to generate the network files(/etc/hostname, /etc/hosts and /etc/resolv.conf) for container. <br>**Default** : `false`|boolean|
|**DiskQuota** <br>*optional*|Set disk quota for container.<br>Key is the dir in container.<br>Value is disk quota size for the dir.<br>/ means rootfs dir in container.<br>.* includes rootfs dir and all volume dir.|< string, string > map|
|**Domainname** <br>*optional*|The domain name to use for the container.|string|
|**Entrypoint** <br>*optional*|The entry point for the container as a string or an array of strings.<br>If the array consists of exactly one empty string (`[""]`) then the entry point is reset to system default.|< string > array|
|**Env** <br>*optional*|A list of environment variables to set inside the container in the form `["VAR=value", ...]`. A variable without `=` is removed from the environment, rather than to have an empty value.|< string > array|
|**ExposedPorts** <br>*optional*|An object mapping ports to an empty object in the form:`{<port>/<tcp\|udp>: {}}`|< string, object > map|
|**HostConfig** <br>*optional*||[HostConfig](#hostconfig)|
|**Hostname** <br>*optional*|The hostname to use for the container, as a valid RFC 1123 hostname. <br>**Minimum length** : `1`|string (hostname)|
|**Image** <br>*required*|The name of the image to use when creating the container|string|
|**InitScript** <br>*optional*|Initial script executed in container. The script will be executed before entrypoint or command|string|
|**Labels** <br>*optional*|User-defined key/value metadata.|< string, string > map|
|**MacAddress** <br>*optional*|MAC address of the container.|string|
|**NetPriority** <br>*optional*|net priority.|integer|
|**NetworkDisabled** <br>*optional*|Disable networking for the container.|boolean|
|**OnBuild** <br>*optional*|`ONBUILD` metadata that were defined.|< string > array|
|**OpenStdin** <br>*optional*|Open `stdin`|boolean|
|**QuotaID** <br>*optional*|Set disk quota by specified quota id. <br>If QuotaID <= 0, it means pouchd should allocate a unique quota id by sequence automatically.<br>By default, a quota ID is mapped to only one container. And one quota ID can include several mountpoint.|string|
|**Rich** <br>*optional*|Whether to start container in rich container mode. (default false)|boolean|
|**RichMode** <br>*optional*|Choose one rich container mode.(default dumb-init)|enum (dumb-init, sbin-init, systemd)|
|**Shell** <br>*optional*|Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.|< string > array|
|**SpecAnnotation** <br>*optional*|annotations send to runtime spec.|< string, string > map|
|**StdinOnce** <br>*optional*|Close `stdin` after one attached client disconnects|boolean|
|**StopSignal** <br>*optional*|Signal to stop a container as a string or unsigned integer. <br>**Default** : `"SIGTERM"`|string|
|**StopTimeout** <br>*optional*|Timeout to stop a container in seconds.|integer|
|**Tty** <br>*optional*|Attach standard streams to a TTY, including `stdin` if it is not closed.|boolean|
|**User** <br>*optional*|The user that commands are run as inside the container.|string|
|**Volumes** <br>*optional*|An object mapping mount point paths inside the container to empty objects.|< string, object > map|
|**WorkingDir** <br>*optional*|The working directory for commands to run in.|string|
|**Cmd** <br>*optional*|Execution commands and args|< string > array|
|**Entrypoint** <br>*optional*|The entrypoint for the container as a string or an array of strings.<br>If the array consists of exactly one empty string (`[""]`) then the entry point is reset to system default.|< string > array|
|**Image** <br>*required*||string|


<a name="daemonupdateconfig"></a>
Expand Down
75 changes: 7 additions & 68 deletions docs/commandline/pouch_upgrade.md
Expand Up @@ -4,88 +4,27 @@ Upgrade a container with new image and args

### Synopsis

Upgrade a container with new image and args
upgrade is a feature to replace a container's image.You can specify the new Entrypoint and Cmd for the new container. When you want to updatea container's image, but inherit the network and volumes of the old container, then you shouldthink about the upgrade feature.

```
pouch upgrade [OPTIONS] IMAGE [COMMAND] [ARG...]
pouch upgrade [OPTIONS] CONTAINER [COMMAND] [ARG...]
```

### Examples

```
$ pouch run -d -m 20m --name test1 registry.hub.docker.com/library/busybox:latest
$ pouch run -d -m 20m --name test registry.hub.docker.com/library/busybox:latest
4c58d27f58d38776dda31c01c897bbf554c802a9b80ae4dc20be1337f8a969f2
$ pouch upgrade --name test1 registry.hub.docker.com/library/hello-world:latest
$ pouch upgrade --image registry.hub.docker.com/library/hello-world:latest test
test1
```

### Options

```
--annotation strings Additional annotation for runtime
--blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable
--blkio-weight-device value Block IO weight (relative device weight), need CFQ IO Scheduler enable (default [])
--cap-add strings Add Linux capabilities
--cap-drop strings Drop Linux capabilities
--cgroup-parent string Optional parent cgroup for the container
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period, range is in [1000(1ms),1000000(1s)]
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota, range is in [1000,∞)
--cpu-shares int CPU shares (relative weight)
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
--device strings Add a host device to the container
--device-read-bps value Limit read rate (bytes per second) from a device (default [])
--device-read-iops value Limit read rate (IO per second) from a device (default [])
--device-write-bps value Limit write rate (bytes per second) from a device (default [])
--device-write-iops value Limit write rate (IO per second) from a device (default [])
--disable-network-files Disable the generation of network files(/etc/hostname, /etc/hosts and /etc/resolv.conf) for container. If true, no network files will be generated. Default false
--disk-quota strings Set disk quota for container
--enableLxcfs Enable lxcfs for the container, only effective when enable-lxcfs switched on in Pouchd
--entrypoint string Overwrite the default ENTRYPOINT of the image
-e, --env stringArray Set environment variables for container
--expose strings Set expose container's ports
--group-add strings Add additional groups to join
-h, --help help for upgrade
--hostname string Set container's hostname
--initscript string Initial script executed in container
--intel-rdt-l3-cbm string Limit container resource for Intel RDT/CAT which introduced in Linux 4.10 kernel
--ipc string IPC namespace to use
-l, --label stringArray Set labels for a container
--log-driver string Logging driver for the container (default "json-file")
--log-opt stringArray Log driver options
-m, --memory string Memory limit
--memory-extra int Represent container's memory high water mark percentage, range in [0, 100]
--memory-force-empty-ctl int Whether to reclaim page cache when deleting the cgroup of container
--memory-swap string Swap limit equal to memory + swap, '-1' to enable unlimited swap
--memory-swappiness int Container memory swappiness [0, 100]
--memory-wmark-ratio int Represent this container's memory low water mark percentage, range in [0, 100]. The value of memory low water mark is memory.limit_in_bytes * MemoryWmarkRatio
--name string Specify name of container
--net strings Set networks to container
--net-priority int net priority
--nvidia-capabilities string NvidiaDriverCapabilities controls which driver libraries/binaries will be mounted inside the container
--nvidia-visible-devs string NvidiaVisibleDevices controls which GPUs will be made accessible inside the container
--oom-kill-disable Disable OOM Killer
--oom-score-adj int Tune host's OOM preferences (-1000 to 1000) (default -500)
--pid string PID namespace to use
--pids-limit int Set container pids limit
-p, --port strings Set container ports mapping
--privileged Give extended privileges to the container
--quota-id string Specified quota id, if id < 0, it means pouchd alloc a unique quota id
--restart string Restart policy to apply when container exits
--rich Start container in rich container mode. (default false)
--rich-mode string Choose one rich container mode. dumb-init(default), systemd, sbin-init
--runtime string OCI runtime to use for this container
--sche-lat-switch int Whether to enable scheduler latency count in cpuacct
--security-opt strings Security Options
--shm-size string Size of /dev/shm, default value is 64MB
--sysctl strings Sysctl options
-t, --tty Allocate a pseudo-TTY
--ulimit value Set container ulimit (default [])
-u, --user string UID
--uts string UTS namespace to use
-v, --volume strings Bind mount volumes to container, format is: [source:]<destination>[:mode], [source] can be volume or host's path, <destination> is container's path, [mode] can be "ro/rw/dr/rr/z/Z/nocopy/private/rprivate/slave/rslave/shared/rshared"
--volumes-from strings set volumes from other containers, format is <container>[:mode]
-w, --workdir string Set the working directory in a container
--entrypoint string Overwrite the default ENTRYPOINT of the image
-h, --help help for upgrade
--image string Specify image of the new container
```

### Options inherited from parent commands
Expand Down

0 comments on commit b2542f1

Please sign in to comment.