【汇总】docker参数、命令
一、说明、介绍
参考官方帮助和网上文章总结下面表格。
Ctrl + F 页面搜索,能更快找到内容
二、参数
排序 | 参数 | 英文说明 | 中文说明 | 备注、示例 |
A | ||||
-a stdin | 指定标准输入输出内容类型,可选 STDIN/STDOUT/STDERR 三项 | |||
B | ||||
C | ||||
--config string | Location of client config files (default "/home/ts/.docker") | |||
-c, --context string |
Name of the context to use to connect to the daemon (overrides |
|||
--cpuset="0-2" or --cpuset="0,1,2": | 绑定容器到指定CPU运行; | --cpuset="0-2" or --cpuset="0,1,2": | ||
D | ||||
-d | 后台运行容器,并返回容器ID; | |||
-D, --debug | Enable debug mode | |||
--dns <DNS IP> | 指定容器使用的DNS服务器,默认和宿主一致; | --dns 8.8.8.8 | ||
--dns-search <example.com> | 指定容器DNS搜索域名,默认和宿主一致; | --dns-search example.com | ||
E | ||||
-e 变量="值" | 设置环境变量; | -e username="ritchie" | ||
--env-file=[文件路径] | 从指定文件读入环境变量; | --env-file=[] | ||
--expose=[] | 开放一个端口或一组端口; | |||
F | ||||
G | ||||
H | ||||
-h "容器hostname" | 指定容器的hostname; | -h "mars" | ||
-H, --host list | Daemon socket to connect to | |||
--help | 帮助 | |||
I | ||||
-i | 以交互模式运行容器,通常与 -t 同时使用; | |||
G | ||||
K | ||||
L | ||||
-l, --log-level string |
Set the logging level ("debug", "info", "warn", "error", "fatal")(default "info") |
|||
--link=[] | 添加链接到另一个容器; | |||
M | ||||
-m | 设置容器使用内存最大值; | |||
N | ||||
--name="容器名" | 为容器指定一个名称; | --name="nginx-lb": | ||
--net="<bridge | host | none | container>" | 指定容器的网络连接类型,支持 bridge/host/none/container: 四种类型; | --net="bridge" | ||
O | ||||
P | ||||
-p | 指定端口映射,格式为:主机(宿主)端口:容器端口 | |||
-P | 随机端口映射,容器内部端口随机映射到主机的高端口 | |||
Q | ||||
R | ||||
S | ||||
T | ||||
-t | 为容器重新分配一个伪输入终端,通常与 -i 同时使用; | |||
U | ||||
V | ||||
--version | Print version information and quit | 查看 docker 精简版本号 | info:查看 docker 详细版本号 | |
-v 或 --volume | 绑定一个卷。挂载目录到容器里 | |||
--volumes-from | 用来指定要从哪个数据卷来挂载数据。 | |||
W | ||||
X | ||||
Y | ||||
Z |
三、Common Commands(常用命令)
使用 docker Commands --help 查看子命令参数
排序 | 命令 | 英文说明 | 中文说明 | 命令类型 | 备注、示例 |
A | |||||
attach | Attach local standard input, output, and error streams to a running container | Commands(命令) | |||
B | |||||
build | Build an image from a Dockerfile | 使用文件生成镜像 | Common Commands(常用命令) | ||
builder | Manage builds | Management Commands(管理命令) | |||
buildx* | Docker Buildx | Management Commands(管理命令) | |||
C | |||||
cp | Copy files/folders between a container and the local filesystem | 拷贝文件到容器内 或 从容器内拷贝出来 | Commands(命令) | ||
compose* | Docker Compose | Management Commands(管理命令) | |||
commit | Create a new image from a container's changes | Commands(命令) | |||
container | Manage containers | Management Commands(管理命令) | |||
context | Manage contexts | Management Commands(管理命令) | |||
create | Create a new container | Commands(命令) | |||
D | |||||
diff | Inspect changes to files or directories on a container's filesystem | Commands(命令) | |||
E | |||||
events | Get real time events from the server | Commands(命令) | |||
exec |
Execute a command in a running container | 容器外向容器里执行命令。进入容器 | Common Commands(常用命令) | ||
export |
Export a container's filesystem as a tar archive | Commands(命令) | |||
F | |||||
G | |||||
H | |||||
history | Show the history of an image | Commands(命令) | |||
I | |||||
image | Manage images | Management Commands(管理命令) | |||
images | List images | 查看本地镜像 | Common Commands(常用命令) | ||
import | Import the contents from a tarball to create a filesystem image | Commands(命令) | |||
info | Display system-wide information | 查看 docker 详细版本号 | Common Commands(常用命令) | --version 查看 docker 精简版本号 | |
inspect | Return low-level information on Docker objects | Commands(命令) | |||
G | |||||
K | |||||
kill | Kill one or more running containers | Commands(命令) | |||
L | |||||
load | Load an image from a tar archive or STDIN | 导入 image 镜像 | Commands(命令) | ||
login | Authenticate to a registry | Common Commands(常用命令) | |||
logout | Log out from a registry | Common Commands(常用命令) | |||
logs | Fetch the logs of a container | Commands(命令) | |||
M | |||||
manifest | Manage Docker image manifests and manifest lists | Management Commands(管理命令) | |||
N | |||||
network | Manage networks | Management Commands(管理命令) | |||
O | |||||
P | |||||
pause | Pause all processes within one or more containers | Commands(命令) | |||
port | List port mappings or a specific mapping for the container | Commands(命令) | |||
ps | List containers | 查看启动的容器 | Common Commands(常用命令) | ||
pull <NAME>:<TAG> | Download an image from a registry | 拉取镜像 | Common Commands(常用命令) | ||
push | Upload an image to a registry | 上传镜像 | Common Commands(常用命令) | ||
plugin | Manage plugins | Management Commands(管理命令) | |||
Q | |||||
R | |||||
restart | Restart one or more containers | Commands(命令) | |||
rename | Rename a container | Commands(命令) | |||
rm <Container ID> |
Remove one or more containers | 删除已经执行容器 | Commands(命令) | Container ID:容器ID |
|
rmi <TAG> | Remove one or more images | 删除镜像 | Commands(命令) | ||
run <Container Name | Container ID > |
Create and run a new container from an image | 首次启动镜像 | Common Commands(常用命令) | ||
S | |||||
save <Container Name | Container ID > |
Save one or more images to a tar archive (streamed to STDOUT by default) | 导出 image 一个或多个镜像 | Common Commands(常用命令) | Container Name: 镜像名 | |
search <KeyWord> | Search Docker Hub for images | 搜索镜像 | KeyWord: 搜索关键字 | ||
start | Start one or more stopped containers | Commands(命令) | |||
stats | Display a live stream of container(s) resource usage statistics | Commands(命令) | |||
stop | Stop one or more running containers | Commands(命令) | |||
swarm | Manage Swarm | Management Commands(管理命令) | |||
system | Manage Docker | Swarm Commands | |||
T | |||||
tag | Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE | Commands(命令) | |||
top | Display the running processes of a container | Commands(命令) | |||
trust | Manage trust on Docker images | Common Commands(常用命令) | |||
U | |||||
unpause | Unpause all processes within one or more containers | Commands(命令) | |||
update | Update configuration of one or more containers | Commands(命令) | |||
V | |||||
version | Show the Docker version information | 显示 Docker 版本 | Common Commands(常用命令) | ||
volume | Manage volumes | Management Commands(管理命令) | |||
W | |||||
wait | Block until one or more containers stop, then print their exit codes | Commands(命令) | |||
X | |||||
Y | |||||
Z |
参考、来源:
https://www.php.cn/faq/484837.html
docker基础知识之挂载本地目录_docker挂载目录-CSDN博客
docker start一个容器之后,怎么进入这个容器界面_打开已经start的docker的终端-CSDN博客