Merge pull request #9388 from SvenDowideit/update-docs-from-cli
Auto-update documentation from the output of the cli.
This commit is contained in:
commit
8e59bda173
19 changed files with 190 additions and 115 deletions
|
@ -104,6 +104,11 @@ def update_man_pages():
|
|||
re.MULTILINE | re.DOTALL
|
||||
)
|
||||
|
||||
options_re = re.compile(
|
||||
r".*# OPTIONS(.*?)# (HISTORY|EXAMPLES?).*",
|
||||
re.MULTILINE | re.DOTALL
|
||||
)
|
||||
|
||||
example_re = re.compile(
|
||||
r".*# EXAMPLES?(.*)# HISTORY.*",
|
||||
re.MULTILINE | re.DOTALL
|
||||
|
@ -116,8 +121,12 @@ def update_man_pages():
|
|||
|
||||
for command in cmds:
|
||||
print "COMMAND: "+command
|
||||
if command == "":
|
||||
print "SKIPPING"
|
||||
continue
|
||||
history = ""
|
||||
description = ""
|
||||
original_options = ""
|
||||
examples = ""
|
||||
if os.path.isfile("docs/man/docker-"+command+".1.md"):
|
||||
intext = open("docs/man/docker-"+command+".1.md", "r")
|
||||
|
@ -126,6 +135,10 @@ def update_man_pages():
|
|||
match = desc_re.match(txt)
|
||||
if match:
|
||||
description = match.group(1)
|
||||
match = options_re.match(txt)
|
||||
if match:
|
||||
original_options = match.group(1)
|
||||
#print "MATCHED OPTIONS\n" + original_options
|
||||
match = example_re.match(txt)
|
||||
if match:
|
||||
examples = match.group(1)
|
||||
|
@ -170,7 +183,7 @@ def update_man_pages():
|
|||
|
||||
# replace [OPTIONS] with the list of params
|
||||
options = ""
|
||||
match = re.match("\[OPTIONS\](.*)", usage)
|
||||
match = re.match("\[OPTIONS\]\s*(.*)", usage)
|
||||
if match:
|
||||
usage = match.group(1)
|
||||
|
||||
|
@ -178,11 +191,13 @@ def update_man_pages():
|
|||
# TODO: sort without the `-`'s
|
||||
for key in sorted(params.keys(), key=lambda s: s.lower()):
|
||||
# split on commas, remove --?.*=.*, put in *'s mumble
|
||||
flags = []
|
||||
ps = []
|
||||
opts = []
|
||||
for k in key_params[key].split(","):
|
||||
match = re.match("(-+)([A-Za-z-0-9]*)(?:=(.*))?", k.lstrip())
|
||||
if match:
|
||||
flags.append("{}{}".format(match.group(1), match.group(2)))
|
||||
p = "**{}{}**".format(match.group(1), match.group(2))
|
||||
o = "**{}{}**".format(match.group(1), match.group(2))
|
||||
if match.group(3):
|
||||
|
@ -203,7 +218,25 @@ def update_man_pages():
|
|||
else:
|
||||
print "nomatch:{}".format(k)
|
||||
new_usage = "{}\n[{}]".format(new_usage, "|".join(ps))
|
||||
|
||||
options = "{}{}\n {}\n\n".format(options, ", ".join(opts), params[key])
|
||||
|
||||
# look at the original options documentation and if its hand written, add it too.
|
||||
print "SVEN_re: "+flags[0]
|
||||
singleoption_re = re.compile(
|
||||
r".*[\r\n]\*\*"+flags[0]+"\*\*([^\r\n]*)[\r\n]+(.*?)[\r\n](\*\*-|# [A-Z]|\*\*[A-Z]+\*\*).*",
|
||||
#r""+flags[0]+"(.*)(^\*\*-.*)?",
|
||||
re.MULTILINE | re.DOTALL
|
||||
)
|
||||
match = singleoption_re.match(original_options)
|
||||
if match:
|
||||
info = match.group(2).strip()
|
||||
print "MATCHED: " + match.group(1).strip()
|
||||
if info != params[key].strip():
|
||||
#info = re.sub(params[key].strip(), '', info, flags=re.MULTILINE)
|
||||
print "INFO changed: " +info
|
||||
options = "{} {}\n\n".format(options, info.strip())
|
||||
|
||||
if new_usage != "":
|
||||
new_usage = "{}\n".format(new_usage.strip())
|
||||
usage = new_usage + usage
|
||||
|
@ -230,8 +263,8 @@ def update_man_pages():
|
|||
".*{}.*".format(date_string),
|
||||
re.MULTILINE | re.DOTALL
|
||||
)
|
||||
if not recent_history_re.match(history):
|
||||
outtext.write("{}, updated by Sven Dowideit <SvenDowideit@home.org.au>\n".format(date_string))
|
||||
# if not recent_history_re.match(history):
|
||||
# outtext.write("{}, updated by Sven Dowideit <SvenDowideit@home.org.au>\n".format(date_string))
|
||||
outtext.close()
|
||||
|
||||
# main
|
||||
|
|
|
@ -8,7 +8,7 @@ docker-attach - Attach to a running container
|
|||
**docker attach**
|
||||
[**--no-stdin**[=*false*]]
|
||||
[**--sig-proxy**[=*true*]]
|
||||
CONTAINER
|
||||
CONTAINER
|
||||
|
||||
# DESCRIPTION
|
||||
If you **docker run** a container in detached mode (**-d**), you can reattach to
|
||||
|
|
|
@ -11,7 +11,7 @@ docker-build - Build a new image from the source code at PATH
|
|||
[**-q**|**--quiet**[=*false*]]
|
||||
[**--rm**[=*true*]]
|
||||
[**-t**|**--tag**[=*TAG*]]
|
||||
PATH | URL | -
|
||||
PATH | URL | -
|
||||
|
||||
# DESCRIPTION
|
||||
This will read the Dockerfile from the directory specified in **PATH**.
|
||||
|
|
|
@ -9,7 +9,7 @@ docker-commit - Create a new image from a container's changes
|
|||
[**-a**|**--author**[=*AUTHOR*]]
|
||||
[**-m**|**--message**[=*MESSAGE*]]
|
||||
[**-p**|**--pause**[=*true*]]
|
||||
CONTAINER [REPOSITORY[:TAG]]
|
||||
CONTAINER [REPOSITORY[:TAG]]
|
||||
|
||||
# DESCRIPTION
|
||||
Using an existing container's name or ID you can create a new image.
|
||||
|
|
|
@ -22,21 +22,24 @@ docker-create - Create a new container
|
|||
[**--expose**[=*[]*]]
|
||||
[**-h**|**--hostname**[=*HOSTNAME*]]
|
||||
[**-i**|**--interactive**[=*false*]]
|
||||
[**--ipc**[=*IPC*]]
|
||||
[**--link**[=*[]*]]
|
||||
[**--lxc-conf**[=*[]*]]
|
||||
[**-m**|**--memory**[=*MEMORY*]]
|
||||
[**--mac-address**[=*MAC-ADDRESS*]]
|
||||
[**--name**[=*NAME*]]
|
||||
[**--net**[=*"bridge"*]]
|
||||
[**-P**|**--publish-all**[=*false*]]
|
||||
[**-p**|**--publish**[=*[]*]]
|
||||
[**--privileged**[=*false*]]
|
||||
[**--restart**[=*RESTART*]]
|
||||
[**--security-opt**[=*[]*]]
|
||||
[**-t**|**--tty**[=*false*]]
|
||||
[**-u**|**--user**[=*USER*]]
|
||||
[**-v**|**--volume**[=*[]*]]
|
||||
[**--volumes-from**[=*[]*]]
|
||||
[**-w**|**--workdir**[=*WORKDIR*]]
|
||||
IMAGE [COMMAND] [ARG...]
|
||||
IMAGE [COMMAND] [ARG...]
|
||||
|
||||
# OPTIONS
|
||||
**-a**, **--attach**=[]
|
||||
|
@ -87,6 +90,11 @@ docker-create - Create a new container
|
|||
**-i**, **--interactive**=*true*|*false*
|
||||
Keep STDIN open even if not attached. The default is *false*.
|
||||
|
||||
**--ipc**=""
|
||||
Default is to create a private IPC namespace (POSIX SysV IPC) for the container
|
||||
'container:<name|id>': reuses another container shared memory, semaphores and message queues
|
||||
'host': use the host shared memory,semaphores and message queues inside the container. Note: the host mode gives the container full access to local shared memory and is therefore considered insecure.
|
||||
|
||||
**--link**=[]
|
||||
Add link to another container in the form of name:alias
|
||||
|
||||
|
@ -96,6 +104,9 @@ docker-create - Create a new container
|
|||
**-m**, **--memory**=""
|
||||
Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||
|
||||
**--mac-address**=""
|
||||
Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
||||
|
||||
**--name**=""
|
||||
Assign a name to the container
|
||||
|
||||
|
@ -120,6 +131,9 @@ docker-create - Create a new container
|
|||
**--restart**=""
|
||||
Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
|
||||
|
||||
**--security-opt**=[]
|
||||
Security Options
|
||||
|
||||
**-t**, **--tty**=*true*|*false*
|
||||
Allocate a pseudo-TTY. The default is *false*.
|
||||
|
||||
|
@ -138,3 +152,4 @@ docker-create - Create a new container
|
|||
# HISTORY
|
||||
August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
September 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
% DOCKER(1) Docker User Manuals
|
||||
% Docker Community
|
||||
% SEPT 2014
|
||||
% JUNE 2014
|
||||
# NAME
|
||||
docker-exec - Run a command in a running container
|
||||
|
||||
|
@ -9,7 +9,7 @@ docker-exec - Run a command in a running container
|
|||
[**-d**|**--detach**[=*false*]]
|
||||
[**-i**|**--interactive**[=*false*]]
|
||||
[**-t**|**--tty**[=*false*]]
|
||||
CONTAINER COMMAND [ARG...]
|
||||
CONTAINER COMMAND [ARG...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
|
@ -19,17 +19,17 @@ The command started using `docker exec` will only run while the container's prim
|
|||
process (`PID 1`) is running, and will not be restarted if the container is restarted.
|
||||
|
||||
If the container is paused, then the `docker exec` command will wait until the
|
||||
container is unpaused, and then run.
|
||||
|
||||
# Options
|
||||
container is unpaused, and then run
|
||||
|
||||
# OPTIONS
|
||||
**-d**, **--detach**=*true*|*false*
|
||||
Detached mode. This runs the new process in the background.
|
||||
Detached mode: run command in the background. The default is *false*.
|
||||
|
||||
**-i**, **--interactive**=*true*|*false*
|
||||
When set to true, keep STDIN open even if not attached. The default is false.
|
||||
Keep STDIN open even if not attached. The default is *false*.
|
||||
|
||||
**-t**, **--tty**=*true*|*false*
|
||||
When set to true Docker can allocate a pseudo-tty and attach to the standard
|
||||
input of the process. This can be used, for example, to run a throwaway
|
||||
interactive shell. The default value is false.
|
||||
Allocate a pseudo-TTY. The default is *false*.
|
||||
|
||||
# HISTORY
|
||||
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
|
|
|
@ -8,7 +8,7 @@ docker-history - Show the history of an image
|
|||
**docker history**
|
||||
[**--no-trunc**[=*false*]]
|
||||
[**-q**|**--quiet**[=*false*]]
|
||||
IMAGE
|
||||
IMAGE
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ docker-images - List images
|
|||
[**-f**|**--filter**[=*[]*]]
|
||||
[**--no-trunc**[=*false*]]
|
||||
[**-q**|**--quiet**[=*false*]]
|
||||
[REPOSITORY]
|
||||
[REPOSITORY]
|
||||
|
||||
# DESCRIPTION
|
||||
This command lists the images stored in the local Docker repository.
|
||||
|
|
|
@ -7,7 +7,7 @@ docker-kill - Kill a running container using SIGKILL or a specified signal
|
|||
# SYNOPSIS
|
||||
**docker kill**
|
||||
[**-s**|**--signal**[=*"KILL"*]]
|
||||
CONTAINER [CONTAINER...]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ docker-login - Register or log in to a Docker registry server, if no server is s
|
|||
[**-e**|**--email**[=*EMAIL*]]
|
||||
[**-p**|**--password**[=*PASSWORD*]]
|
||||
[**-u**|**--username**[=*USERNAME*]]
|
||||
[SERVER]
|
||||
[SERVER]
|
||||
|
||||
# DESCRIPTION
|
||||
Register or Login to a docker registry server, if no server is
|
||||
|
|
|
@ -5,11 +5,15 @@
|
|||
docker-port - List port mappings for the CONTAINER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT
|
||||
|
||||
# SYNOPSIS
|
||||
**docker port** CONTAINER [PRIVATE_PORT[/PROTO]]
|
||||
**docker port**
|
||||
CONTAINER [PRIVATE_PORT[/PROTO]]
|
||||
|
||||
# DESCRIPTION
|
||||
List port mappings for the CONTAINER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT
|
||||
|
||||
# OPTIONS
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
You can find out all the ports mapped by not specifying a `PRIVATE_PORT`, or
|
||||
ask for just a specific mapping:
|
||||
|
@ -30,3 +34,4 @@ ask for just a specific mapping:
|
|||
# HISTORY
|
||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
|
|
|
@ -32,6 +32,7 @@ the running containers.
|
|||
**-f**, **--filter**=[]
|
||||
Provide filter values. Valid filters:
|
||||
exited=<int> - containers with exit code of <int>
|
||||
status=(restarting|running|paused|exited)
|
||||
|
||||
**-l**, **--latest**=*true*|*false*
|
||||
Show only the latest created container, include non-running ones. The default is *false*.
|
||||
|
@ -74,3 +75,4 @@ April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
|||
based on docker.com source material and internal work.
|
||||
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
|
|
|
@ -7,7 +7,7 @@ docker-restart - Restart a running container
|
|||
# SYNOPSIS
|
||||
**docker restart**
|
||||
[**-t**|**--time**[=*10*]]
|
||||
CONTAINER [CONTAINER...]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
Restart each container listed.
|
||||
|
|
|
@ -9,7 +9,7 @@ docker-rm - Remove one or more containers
|
|||
[**-f**|**--force**[=*false*]]
|
||||
[**-l**|**--link**[=*false*]]
|
||||
[**-v**|**--volumes**[=*false*]]
|
||||
CONTAINER [CONTAINER...]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
|
|
|
@ -23,26 +23,26 @@ docker-run - Run a command in a new container
|
|||
[**--expose**[=*[]*]]
|
||||
[**-h**|**--hostname**[=*HOSTNAME*]]
|
||||
[**-i**|**--interactive**[=*false*]]
|
||||
[**--ipc**[=*[]*]]
|
||||
[**--security-opt**[=*[]*]]
|
||||
[**--ipc**[=*IPC*]]
|
||||
[**--link**[=*[]*]]
|
||||
[**--lxc-conf**[=*[]*]]
|
||||
[**-m**|**--memory**[=*MEMORY*]]
|
||||
[**--mac-address**[=*MAC-ADDRESS*]]
|
||||
[**--name**[=*NAME*]]
|
||||
[**--net**[=*"bridge"*]]
|
||||
[**--mac-address**[=*MACADDRESS*]]
|
||||
[**-P**|**--publish-all**[=*false*]]
|
||||
[**-p**|**--publish**[=*[]*]]
|
||||
[**--privileged**[=*false*]]
|
||||
[**--restart**[=*POLICY*]]
|
||||
[**--restart**[=*RESTART*]]
|
||||
[**--rm**[=*false*]]
|
||||
[**--security-opt**[=*[]*]]
|
||||
[**--sig-proxy**[=*true*]]
|
||||
[**-t**|**--tty**[=*false*]]
|
||||
[**-u**|**--user**[=*USER*]]
|
||||
[**-v**|**--volume**[=*[]*]]
|
||||
[**--volumes-from**[=*[]*]]
|
||||
[**-w**|**--workdir**[=*WORKDIR*]]
|
||||
IMAGE [COMMAND] [ARG...]
|
||||
IMAGE [COMMAND] [ARG...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
|
@ -59,21 +59,26 @@ all image dependencies, from the repository in the same way running **docker
|
|||
pull** IMAGE, before it starts the container from that image.
|
||||
|
||||
# OPTIONS
|
||||
**-a**, **--attach**=[]
|
||||
Attach to STDIN, STDOUT or STDERR.
|
||||
|
||||
**-a**, **--attach**=*stdin*|*stdout*|*stderr*
|
||||
Attach to stdin, stdout or stderr. In foreground mode (the default when
|
||||
**-d** is not specified), **docker run** can start the process in the container
|
||||
In foreground mode (the default when **-d**
|
||||
is not specified), **docker run** can start the process in the container
|
||||
and attach the console to the process’s standard input, output, and standard
|
||||
error. It can even pretend to be a TTY (this is what most commandline
|
||||
executables expect) and pass along signals. The **-a** option can be set for
|
||||
each of stdin, stdout, and stderr.
|
||||
|
||||
**--add-host**=*hostname*:*ip*
|
||||
**--add-host**=[]
|
||||
Add a custom host-to-IP mapping (host:ip)
|
||||
|
||||
Add a line to /etc/hosts. The format is hostname:ip. The **--add-host**
|
||||
option can be set multiple times.
|
||||
|
||||
**-c**, **--cpu-shares**=0
|
||||
CPU shares in relative weight. You can increase the priority of a container
|
||||
CPU shares (relative weight)
|
||||
|
||||
You can increase the priority of a container
|
||||
with the -c option. By default, all containers run at the same priority and get
|
||||
the same proportion of CPU cycles, but you can tell the kernel to give more
|
||||
shares of CPU time to one or more containers when you start them via **docker
|
||||
|
@ -92,8 +97,9 @@ run**.
|
|||
CPUs in which to allow execution (0-3, 0,1)
|
||||
|
||||
**-d**, **--detach**=*true*|*false*
|
||||
Detached mode. This runs the container in the background. It outputs the new
|
||||
container's ID and any error messages. At any time you can run **docker ps** in
|
||||
Detached mode: run the container in the background and print the new container ID. The default is *false*.
|
||||
|
||||
At any time you can run **docker ps** in
|
||||
the other shell to view a list of the running containers. You can reattach to a
|
||||
detached container with **docker attach**. If you choose to run a container in
|
||||
the detached mode, then you cannot use the **-rm** option.
|
||||
|
@ -107,19 +113,24 @@ stopping the process by pressing the keys CTRL-P CTRL-Q.
|
|||
**--dns-search**=[]
|
||||
Set custom DNS search domains (Use --dns-search=. if you don't wish to set the search domain)
|
||||
|
||||
**--dns**=*IP-address*
|
||||
Set custom DNS servers. This option can be used to override the DNS
|
||||
**--dns**=[]
|
||||
Set custom DNS servers
|
||||
|
||||
This option can be used to override the DNS
|
||||
configuration passed to the container. Typically this is necessary when the
|
||||
host DNS configuration is invalid for the container (e.g., 127.0.0.1). When this
|
||||
is the case the **--dns** flags is necessary for every run.
|
||||
|
||||
**-e**, **--env**=*environment*
|
||||
Set environment variables. This option allows you to specify arbitrary
|
||||
**-e**, **--env**=[]
|
||||
Set environment variables
|
||||
|
||||
This option allows you to specify arbitrary
|
||||
environment variables that are available for the process that will be launched
|
||||
inside of the container.
|
||||
|
||||
**--entrypoint**=""
|
||||
Overwrite the default ENTRYPOINT of the image
|
||||
|
||||
**--entrypoint**=*command*
|
||||
This option allows you to overwrite the default entrypoint of the image that
|
||||
is set in the Dockerfile. The ENTRYPOINT of an image is similar to a COMMAND
|
||||
because it specifies what executable to run when the container starts, but it is
|
||||
|
@ -137,27 +148,25 @@ ENTRYPOINT.
|
|||
**--expose**=[]
|
||||
Expose a port or a range of ports (e.g. --expose=3300-3310) from the container without publishing it to your host
|
||||
|
||||
**-h**, **--hostname**=*hostname*
|
||||
**-h**, **--hostname**=""
|
||||
Container host name
|
||||
|
||||
Sets the container host name that is available inside the container.
|
||||
|
||||
**-i**, **--interactive**=*true*|*false*
|
||||
Keep STDIN open even if not attached. The default is *false*.
|
||||
|
||||
When set to true, keep stdin open even if not attached. The default is false.
|
||||
|
||||
**--ipc**=[]
|
||||
Set the IPC mode for the container
|
||||
**container**:<*name*|*id*>: reuses another container's IPC stack
|
||||
**host**: use the host's IPC stack inside the container.
|
||||
Note: the host mode gives the container full access to local IPC and is therefore considered insecure.
|
||||
**--ipc**=""
|
||||
Default is to create a private IPC namespace (POSIX SysV IPC) for the container
|
||||
'container:<name|id>': reuses another container shared memory, semaphores and message queues
|
||||
'host': use the host shared memory,semaphores and message queues inside the container. Note: the host mode gives the container full access to local shared memory and is therefore considered insecure.
|
||||
|
||||
**--security-opt**=*secdriver*:*name*:*value*
|
||||
"label:user:USER" : Set the label user for the container
|
||||
"label:role:ROLE" : Set the label role for the container
|
||||
"label:type:TYPE" : Set the label type for the container
|
||||
"label:level:LEVEL" : Set the label level for the container
|
||||
"label:disable" : Turn off label confinement for the container
|
||||
**--link**=[]
|
||||
Add link to another container in the form of name:alias
|
||||
|
||||
**--link**=*name*:*alias*
|
||||
Add link to another container. The format is name:alias. If the operator
|
||||
If the operator
|
||||
uses **--link** when starting the new client container, then the client
|
||||
container can access the exposed port via a private networking interface. Docker
|
||||
will set some environment variables in the client container to help indicate
|
||||
|
@ -166,7 +175,9 @@ which interface and port to use.
|
|||
**--lxc-conf**=[]
|
||||
(lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
|
||||
|
||||
**-m**, **--memory**=*memory-limit*
|
||||
**-m**, **--memory**=""
|
||||
Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||
|
||||
Allows you to constrain the memory available to a container. If the host
|
||||
supports swap memory, then the -m memory setting can be larger than physical
|
||||
RAM. If a limit of 0 is specified, the container's memory is not limited. The
|
||||
|
@ -174,15 +185,23 @@ actual limit may be rounded up to a multiple of the operating system's page
|
|||
size, if it is not already. The memory limit should be formatted as follows:
|
||||
`<number><optional unit>`, where unit = b, k, m or g.
|
||||
|
||||
**--name**=*name*
|
||||
Assign a name to the container. The operator can identify a container in
|
||||
three ways:
|
||||
**--mac-address**=""
|
||||
Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
||||
|
||||
Remember that the MAC address in an Ethernet network must be unique.
|
||||
The IPv6 link-local address will be based on the device's MAC address
|
||||
according to RFC4862.
|
||||
|
||||
**--name**=""
|
||||
Assign a name to the container
|
||||
|
||||
The operator can identify a container in three ways:
|
||||
|
||||
UUID long identifier (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”)
|
||||
UUID short identifier (“f78375b1c487”)
|
||||
Name (“jonah”)
|
||||
|
||||
The UUID identifiers come from the Docker daemon, and if a name is not assigned
|
||||
The UUID identifiers come from the Docker daemon, and if a name is not assigned
|
||||
to the container with **--name** then the daemon will also generate a random
|
||||
string name. The name is useful when defining links (see **--link**) (or any
|
||||
other place you need to identify a container). This works for both background
|
||||
|
@ -190,21 +209,14 @@ and foreground Docker containers.
|
|||
|
||||
**--net**="bridge"
|
||||
Set the Network mode for the container
|
||||
**bridge**: creates a new network stack for the container on the docker bridge
|
||||
**none**: no networking for this container
|
||||
**container**:<*name*|*id*>: reuses another container's network stack
|
||||
**host**: use the host network stack inside the container.
|
||||
Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
|
||||
|
||||
**--mac-address**=*macaddress*
|
||||
Set the MAC address for the container's Ethernet device:
|
||||
--mac-address=12:34:56:78:9a:bc
|
||||
|
||||
Remember that the MAC address in an Ethernet network must be unique.
|
||||
The IPv6 link-local address will be based on the device's MAC address
|
||||
according to RFC4862.
|
||||
'bridge': creates a new network stack for the container on the docker bridge
|
||||
'none': no networking for this container
|
||||
'container:<name|id>': reuses another container network stack
|
||||
'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
|
||||
|
||||
**-P**, **--publish-all**=*true*|*false*
|
||||
Publish all exposed ports to the host interfaces. The default is *false*.
|
||||
|
||||
When set to true publish all exposed ports to the host interfaces. The
|
||||
default is false. If the operator uses -P (or -p) then Docker will make the
|
||||
exposed port accessible on the host and the ports will be available to any
|
||||
|
@ -213,29 +225,44 @@ ports to a random port on the host between 49153 and 65535. To find the
|
|||
mapping between the host ports and the exposed ports, use **docker port**.
|
||||
|
||||
**-p**, **--publish**=[]
|
||||
Publish a container's port to the host (format: ip:hostPort:containerPort |
|
||||
ip::containerPort | hostPort:containerPort | containerPort) (use **docker port** to see the
|
||||
actual mapping)
|
||||
Publish a container's port to the host
|
||||
format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
|
||||
(use 'docker port' to see the actual mapping)
|
||||
|
||||
**--privileged**=*true*|*false*
|
||||
Give extended privileges to this container. By default, Docker containers are
|
||||
Give extended privileges to this container. The default is *false*.
|
||||
|
||||
By default, Docker containers are
|
||||
“unprivileged” (=false) and cannot, for example, run a Docker daemon inside the
|
||||
Docker container. This is because by default a container is not allowed to
|
||||
access any devices. A “privileged” container is given access to all devices.
|
||||
|
||||
When the operator executes **docker run --privileged**, Docker will enable access
|
||||
When the operator executes **docker run --privileged**, Docker will enable access
|
||||
to all devices on the host as well as set some configuration in AppArmor to
|
||||
allow the container nearly all the same access to the host as processes running
|
||||
outside of a container on the host.
|
||||
|
||||
**--restart**=""
|
||||
Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
|
||||
|
||||
**--rm**=*true*|*false*
|
||||
Automatically remove the container when it exits (incompatible with -d). The default is *false*.
|
||||
|
||||
**--security-opt**=[]
|
||||
Security Options
|
||||
|
||||
"label:user:USER" : Set the label user for the container
|
||||
"label:role:ROLE" : Set the label role for the container
|
||||
"label:type:TYPE" : Set the label type for the container
|
||||
"label:level:LEVEL" : Set the label level for the container
|
||||
"label:disable" : Turn off label confinement for the container
|
||||
|
||||
**--sig-proxy**=*true*|*false*
|
||||
Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is *true*.
|
||||
|
||||
**-t**, **--tty**=*true*|*false*
|
||||
Allocate a pseudo-TTY. The default is *false*.
|
||||
|
||||
When set to true Docker can allocate a pseudo-tty and attach to the standard
|
||||
input of any container. This can be used, for example, to run a throwaway
|
||||
interactive shell. The default is value is false.
|
||||
|
@ -243,52 +270,39 @@ interactive shell. The default is value is false.
|
|||
**-u**, **--user**=""
|
||||
Username or UID
|
||||
|
||||
**-v**, **--volume**=[]
|
||||
Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)
|
||||
|
||||
**-v**, **--volume**=*volume*[:ro|:rw]
|
||||
Bind mount a volume to the container.
|
||||
|
||||
The **-v** option can be used one or
|
||||
The **-v** option can be used one or
|
||||
more times to add one or more mounts to a container. These mounts can then be
|
||||
used in other containers using the **--volumes-from** option.
|
||||
|
||||
The volume may be optionally suffixed with :ro or :rw to mount the volumes in
|
||||
The volume may be optionally suffixed with :ro or :rw to mount the volumes in
|
||||
read-only or read-write mode, respectively. By default, the volumes are mounted
|
||||
read-write. See examples.
|
||||
|
||||
**--volumes-from**=*container-id*[:ro|:rw]
|
||||
**--volumes-from**=[]
|
||||
Mount volumes from the specified container(s)
|
||||
|
||||
Will mount volumes from the specified container identified by container-id.
|
||||
Once a volume is mounted in a one container it can be shared with other
|
||||
containers using the **--volumes-from** option when running those other
|
||||
containers. The volumes can be shared even if the original container with the
|
||||
mount is not running.
|
||||
|
||||
The container ID may be optionally suffixed with :ro or
|
||||
The container ID may be optionally suffixed with :ro or
|
||||
:rw to mount the volumes in read-only or read-write mode, respectively. By
|
||||
default, the volumes are mounted in the same mode (read write or read only) as
|
||||
the reference container.
|
||||
|
||||
**-w**, **--workdir**=""
|
||||
Working directory inside the container
|
||||
|
||||
**-w**, **--workdir**=*directory*
|
||||
Working directory inside the container. The default working directory for
|
||||
The default working directory for
|
||||
running binaries within a container is the root directory (/). The developer can
|
||||
set a different default with the Dockerfile WORKDIR instruction. The operator
|
||||
can override the working directory by using the **-w** option.
|
||||
|
||||
|
||||
**IMAGE**
|
||||
The image name or ID. You can specify a version of an image you'd like to run
|
||||
the container with by adding image:tag to the command. For example,
|
||||
`docker run ubuntu:14.04`.
|
||||
|
||||
|
||||
|
||||
**COMMAND**
|
||||
The command or program to run inside the image.
|
||||
|
||||
|
||||
**ARG**
|
||||
The arguments for the command to be run in the container.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Exposing log messages from the container to the host's log
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
% Docker Community
|
||||
% JUNE 2014
|
||||
# NAME
|
||||
docker-save - Save an image to a tar archive (streamed to STDOUT by default)
|
||||
docker-save - Save an image(s) to a tar archive (streamed to STDOUT by default)
|
||||
|
||||
# SYNOPSIS
|
||||
**docker save**
|
||||
[**-o**|**--output**[=*OUTPUT*]]
|
||||
IMAGE
|
||||
IMAGE [IMAGE...]
|
||||
|
||||
# DESCRIPTION
|
||||
Produces a tarred repository to the standard output stream. Contains all
|
||||
|
@ -35,3 +35,4 @@ fedora image to a fedora-latest.tar:
|
|||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||
based on docker.com source material and internal work.
|
||||
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||
|
|
|
@ -7,7 +7,7 @@ docker-stop - Stop a running container by sending SIGTERM and then SIGKILL after
|
|||
# SYNOPSIS
|
||||
**docker stop**
|
||||
[**-t**|**--time**[=*10*]]
|
||||
CONTAINER [CONTAINER...]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
Stop a running container (Send SIGTERM, and then SIGKILL after
|
||||
|
|
|
@ -7,7 +7,7 @@ docker-tag - Tag an image into a repository
|
|||
# SYNOPSIS
|
||||
**docker tag**
|
||||
[**-f**|**--force**[=*false*]]
|
||||
IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
|
||||
IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
|
||||
|
||||
# DESCRIPTION
|
||||
This will give a new alias to an image in the repository. This refers to the
|
||||
|
|
|
@ -315,7 +315,6 @@ To kill the container, use `docker kill`.
|
|||
|
||||
--force-rm=false Always remove intermediate containers, even after unsuccessful builds
|
||||
--no-cache=false Do not use cache when building the image
|
||||
--pull=false Always attempt to pull a newer version of the image
|
||||
-q, --quiet=false Suppress the verbose output generated by the containers
|
||||
--rm=true Remove intermediate containers after a successful build
|
||||
-t, --tag="" Repository name (and optionally a tag) to be applied to the resulting image in case of success
|
||||
|
@ -538,11 +537,14 @@ Creates a new container.
|
|||
--expose=[] Expose a port or a range of ports (e.g. --expose=3300-3310) from the container without publishing it to your host
|
||||
-h, --hostname="" Container host name
|
||||
-i, --interactive=false Keep STDIN open even if not attached
|
||||
--ipc="" Default is to create a private IPC namespace (POSIX SysV IPC) for the container
|
||||
'container:<name|id>': reuses another container shared memory, semaphores and message queues
|
||||
'host': use the host shared memory,semaphores and message queues inside the container. Note: the host mode gives the container full access to local shared memory and is therefore considered insecure.
|
||||
--link=[] Add link to another container in the form of name:alias
|
||||
--lxc-conf=[] (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
|
||||
-m, --memory="" Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||
--mac-address="" Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
||||
--name="" Assign a name to the container
|
||||
--mac-address="" Set the container's MAC address
|
||||
--net="bridge" Set the Network mode for the container
|
||||
'bridge': creates a new network stack for the container on the docker bridge
|
||||
'none': no networking for this container
|
||||
|
@ -554,6 +556,7 @@ Creates a new container.
|
|||
(use 'docker port' to see the actual mapping)
|
||||
--privileged=false Give extended privileges to this container
|
||||
--restart="" Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
|
||||
--security-opt=[] Security Options
|
||||
-t, --tty=false Allocate a pseudo-TTY
|
||||
-u, --user="" Username or UID
|
||||
-v, --volume=[] Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)
|
||||
|
@ -614,10 +617,7 @@ For example:
|
|||
Usage: docker events [OPTIONS]
|
||||
|
||||
Get real time events from the server
|
||||
-f, --filter=[] Provide filter values. Valid filters:
|
||||
event=<string> - event to filter
|
||||
image=<string> - image to filter
|
||||
container=<string> - container to filter
|
||||
|
||||
--since="" Show all events created since timestamp
|
||||
--until="" Stream events until this timestamp
|
||||
|
||||
|
@ -1321,9 +1321,13 @@ removed before the image is removed.
|
|||
--expose=[] Expose a port or a range of ports (e.g. --expose=3300-3310) from the container without publishing it to your host
|
||||
-h, --hostname="" Container host name
|
||||
-i, --interactive=false Keep STDIN open even if not attached
|
||||
--ipc="" Default is to create a private IPC namespace (POSIX SysV IPC) for the container
|
||||
'container:<name|id>': reuses another container shared memory, semaphores and message queues
|
||||
'host': use the host shared memory,semaphores and message queues inside the container. Note: the host mode gives the container full access to local shared memory and is therefore considered insecure.
|
||||
--link=[] Add link to another container in the form of name:alias
|
||||
--lxc-conf=[] (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
|
||||
-m, --memory="" Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||
--mac-address="" Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
||||
--name="" Assign a name to the container
|
||||
--net="bridge" Set the Network mode for the container
|
||||
'bridge': creates a new network stack for the container on the docker bridge
|
||||
|
@ -1337,6 +1341,7 @@ removed before the image is removed.
|
|||
--privileged=false Give extended privileges to this container
|
||||
--restart="" Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
|
||||
--rm=false Automatically remove the container when it exits (incompatible with -d)
|
||||
--security-opt=[] Security Options
|
||||
--sig-proxy=true Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.
|
||||
-t, --tty=false Allocate a pseudo-TTY
|
||||
-u, --user="" Username or UID
|
||||
|
@ -1682,8 +1687,8 @@ more details on finding shared images from the command line.
|
|||
|
||||
Restart a stopped container
|
||||
|
||||
-a, --attach=false Attach container's `STDOUT` and `STDERR` and forward all signals to the process
|
||||
-i, --interactive=false Attach container's `STDIN`
|
||||
-a, --attach=false Attach container's STDOUT and STDERR and forward all signals to the process
|
||||
-i, --interactive=false Attach container's STDIN
|
||||
|
||||
When run on a container that has already been started,
|
||||
takes no action and succeeds unconditionally.
|
||||
|
@ -1692,7 +1697,7 @@ takes no action and succeeds unconditionally.
|
|||
|
||||
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
|
||||
|
||||
Stop a running container by sending `SIGTERM` and then `SIGKILL` after a grace period
|
||||
Stop a running container by sending SIGTERM and then SIGKILL after a grace period
|
||||
|
||||
-t, --time=10 Number of seconds to wait for the container to stop before killing it. Default is 10 seconds.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue