Add syntax and examples to the description text of some complex options#3417
Add syntax and examples to the description text of some complex options#3417gibson042 wants to merge 6 commits into
Conversation
| @@ -14,122 +14,113 @@ Usage: docker create [OPTIONS] IMAGE [COMMAND] [ARG...] | |||
| Create a new container | |||
|
|
|||
| Options: | |||
There was a problem hiding this comment.
These changes are best viewed while ignoring whitespace. There are some actual changes, but only because docs/reference/commandline/ apparently contains stale content.
| "type=volume,target=/mnt/persistent" or | ||
| "type=bind,ro,src=/var/run/docker.sock,dst=/run/host-docker.sock") | ||
| --name string Assign a name to the container | ||
| --network network Connect a container to a network |
There was a problem hiding this comment.
Should the list of special --network values be documented by the actual description in cli/command/container/opts.go?
| --shm-size bytes Size of /dev/shm | ||
| The format is `<number><unit>`. `number` must be greater than `0`. | ||
| Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), | ||
| or `g` (gigabytes). If you omit the unit, the system uses bytes. |
There was a problem hiding this comment.
Is this ability to specify --shm-size units accurate, and if so should it be documented by the actual description in cli/command/container/opts.go?
| -u, --user string Username or UID (format: <name|uid>[:<group|gid>]) | ||
| --userns string User namespace to use | ||
| 'host': Use the Docker host user namespace | ||
| '': Use the Docker daemon user namespace specified by `--userns-remap` option. |
There was a problem hiding this comment.
Should the list of special --userns values be documented by the actual description in cli/command/container/opts.go?
| --userns string User namespace to use | ||
| --uts string UTS namespace to use | ||
| -v, --volume list Bind mount a volume (format: [<volume name|absolute | ||
| host path>:]<absolute container path>[:<options>]) |
There was a problem hiding this comment.
Should the description of --volume in cli/command/container/opts.go include the list of options?
|
I'm also not clear on how (if at all) contrib/completion/ files should be updated. |
| --entrypoint string Overwrite the default ENTRYPOINT of the image | ||
| -e, --env list Set environment variables | ||
| --env-file list Read in a file of environment variables | ||
| --expose list Expose a port or a range of ports |
There was a problem hiding this comment.
"range of ports" seems sufficiently special to merit more text, perhaps something like this?
--expose list Expose a port or a range of ports (e.g., "80,443,2379-2380")
Signed-off-by: Richard Gibson <richard.gibson@gmail.com>
```sh
for cmd in create run; do
doc="docs/reference/commandline/$cmd.md"
tmp="$(mktemp)"
awk -v cmd="$cmd" '
# Replace the contents of the first markdown block
# with output from docker help (omitting leading blank lines).
/^```markdown/ && !replaced {
# Print the block start.
print;
# Insert `docker help` output.
while(("./build/docker help " cmd | getline)>0) {
if(NF>0) trimmed=1;
if(trimmed) print;
}
# Advance to the block end.
while(getline>0 && $0!="```");
replaced++;
}
{ print }
' "$doc" >"$tmp" && \
mv "$tmp" "$doc"
done
```
Signed-off-by: Richard Gibson <richard.gibson@gmail.com>
Signed-off-by: Richard Gibson <richard.gibson@gmail.com>
Signed-off-by: Richard Gibson <richard.gibson@gmail.com>
```sh
for cmd in build create run update; do
doc="docs/reference/commandline/$cmd.md"
tmp="$(mktemp)"
awk -v cmd="$cmd" '
# Replace the contents of the first markdown block
# with output from docker help (omitting leading blank lines).
/^```markdown/ && !replaced {
# Print the block start.
print;
# Insert `docker help` output.
while(("./build/docker help " cmd | getline)>0) {
if(NF>0) trimmed=1;
if(trimmed) print;
}
# Advance to the block end.
while(getline>0 && $0!="```");
replaced++;
}
{ print }
' "$doc" >"$tmp" && \
mv "$tmp" "$doc"
done
```
Signed-off-by: Richard Gibson <richard.gibson@gmail.com>
Signed-off-by: Richard Gibson <richard.gibson@gmail.com>
78648be to
3f807a4
Compare
- What I did
--publishand--volume, and values for--restart.--mountlike those at https://docs.docker.com/engine/reference/commandline/run/#add-bind-mounts-or-volumes-using-the---mount-flag .- How I did it
Updated
flagsdescription arguments in cli/command/ files.- How to verify it
Build the
dockerexecutable and invoke it withhelp runorhelp create.- Description for the changelog
Add syntax and examples to the description text of some complex options.
- A picture of a cute animal (not mandatory but encouraged)

https://twitter.com/EveryBat/status/1229018840308125696