增加以随即映射端口方式启动命令.

Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
rick.chan 2020-05-12 16:49:40 +08:00
parent db27ebc9eb
commit c6869288c2
1 changed files with 2 additions and 0 deletions

View File

@ -91,6 +91,8 @@ docker pull ubuntu:18.04
docker run <image name/id>
# 运行某镜像,为之创建容器,将宿主机端口影射到容器端口,并将宿主机的某目录挂载到容器的对应目录下
docker run -it -p <host ip:port><container port> -v <host dir>:<container dir> <image name/id> /bin/bash
# 运行某镜像,为之创建容器,随机映射主机端口和容器端口,并将宿主机的某目录挂载到容器的对应目录下
docker run -it -P -v <host dir>:<container dir> <image name/id> /bin/bash
# 运行某镜像,为之创建容器,设置网络参数,并将宿主机的某目录挂载到容器的对应目录下
docker run --net=<bridge/host/container:container name or id/none> -it -v <host dir>:<container dir> <image name/id> /bin/bash
# 查看正在运行的容器