1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| Options: --add-host Add a custom host-to-IP mapping (host:ip) --attach , -a Attach to STDIN, STDOUT or STDERR --env , -e Set environment variables --env-file Read in a file of environment variables --entrypoint Overwrite the default ENTRYPOINT of the image --expose Expose a port or a range of ports --gpus GPU devices to add to the container ('all' to pass all GPUs) --interactive , -i Keep STDIN open even if not attached --label , -l Set meta data on a container --label-file Read in a line delimited file of labels --link Add link to another container --mount Attach a filesystem mount to the container --name Assign a name to the container --privileged Give extended privileges to this container --publish , -p Publish a container's port(s) to the host --publish-all , -P Publish all exposed ports to random ports --pull Pull image before creating,default is missing ("always"|"missing"|"never") --read-only Mount the container's root filesystem as read only --restart Restart policy to apply when a container exits,default is no,可选参数no,on-failure,unless-stopped,always --rm Automatically remove the container when it exits --tty , -t Allocate a pseudo-TTY --user , -u Username or UID (format: <name|uid>[:<group|gid>]) --volume , -v Bind mount a volume --volumes-from Mount volumes from the specified container(s) --workdir , -w Working directory inside the container --cpus Number of CPUs --memory , -m Memory limit --dns Set custom DNS servers --dns-option Set DNS options --dns-search Set custom DNS search domains --hostname , -h Container host name --ip IPv4 address --ip6 IPv6 address --network Connect a container to a network --network-alias Add network-scoped alias for the container --oom-kill-disable Disable OOM Killer
--restart 重启策略 no 容器退出后不重启容器,此为默认策略 always 总是重启容器,不管容器是否为异常退出 on-failure[:max-retries] 当容器异常退出(状态码为非0)时重启容器,可以设置最大重启次数 unless-stopped 当容器被手动停止或docker服务停止(或重启)时不重启容器
|