1、Docker操作命令
1.1、Docker命令汇总
语法:docker [OPTIONS] COMMAND
选项:
| 选项 | 英文说明&中文说明 |
|---|---|
| --config string | Location of client config files (default "/root/.docker") 客户端配置文件的位置(默认为“/root/.docker”) |
| -c, --context string | Name of the context to use to connect to the daemon(overrides DOCKER_HOST env var and default context set with "docker context use") 用于连接守护进程的上下文的名称(覆盖DOCKER_HOST env var和用“docker context use”设置的默认上下文) |
| -D, --debug | Enable debug mode 启用调试模式 |
| -H, --host list | Daemon socket(s) to connect to 要连接的守护进程套接字 |
| -l, --log-level string | Set the logging evel("debug"|"info"|"warn"|"error"|"fatal") (default "info") 设置日志级别("debug"|"info"|"warn"|"error"|"fatal")(默认"info") |
| --tls | Use TLS; implied by --tlsverify 使用TLS;暗示了——tlsverify |
| --tlscacert string | Trust certs signed only by this CA (default "/root/.docker/ca.pem") 仅由此CA签名的信任证书(默认为“/root/.docker/ CA .pem”) |
| --tlscert string | Path to TLS certificate file (default "/root/.docker/cert.pem") TLS证书文件的路径(默认为“/root/.docker/cert.pem”) |
| --tlskey string | Path to TLS key file (default "/root/.docker/key.pem") TLS密钥文件的路径(默认为“/root/.docker/key.pem”) |
| --tlsverify | Use TLS and verify the remote 使用TLS并验证远程 |
| -v, --version | Print version information and quit 打印版本信息并退出 |
管理命令:
| 命令 | 英文说明&中文说明 |
|---|---|
| builder | Manage builds 管理构建 |
| config | Manage Docker configs 管理Docker配置 |
| container | Manage containers 管理容器 |
| context | Manage contexts 管理上下文 |
| engine | Manage the docker engine 管理Docker引擎 |
| image | Manage images 管理镜像 |
| network | Manage networks 管理网络 |
| node | Manage Swarm nodes 管理集群节点 |
| plugin | Manage plugins 管理插件 |
| secret | Manage Docker secrets 管理Docker的加密 |
| service | Manage services 管理服务 |
| stack | Manage Docker stacks 管理Docker栈 |
| swarm | Manage Swarm 管理集群 |
| system | Manage Docker 管理Docker |
| trust | Manage trust on Docker images 管理Docker镜像的信任 |
| volume | Manage volumes 管理卷 |
命令:
| 命令 | 英文说明&中文说明 |
|---|---|
| attach | Attach local standard input, output, and error streams to a running container 将本地标准输入、输出和错误流附加到正在运行的容器中 |
| build | Build an image from a Dockerfile 从Dockerfile构建一个映像 |
| commit | Create a new image from a container's changes 根据容器的更改创建新映像 |
| cp | Copy files/folders between a container and the local filesystem 在容器和本地文件系统之间复制文件/文件夹 |
| create | Create a new container 创建一个新容器 |
| diff | Inspect changes to files or directories on a container's filesystem 检查容器文件系统中文件或目录的更改 |
| events | Get real time events from the server 从服务器获取实时事件 |
| exec | Run a command in a running container 在正在运行的容器中运行命令 |
| export | Export a container's filesystem as a tar archive 将容器的文件系统导出为tar归档文件 |
| history | Show the history of an image 显示镜像的构建历史 |
| images | List images 镜像列表 |
| import | Import the contents from a tarball to create a filesystem image 从tarball导入内容以创建文件系统映像 |
| info | Display system-wide information 显示整个系统的信息 |
| inspect | Return low-level information on Docker objects 返回Docker对象的低级信息 |
| kill | Kill one or more running containers 杀死一个或多个正在运行的容器 |
| load | Load an image from a tar archive or STDIN 从tar存档或STDIN加载镜像 |
| login | Log in to a Docker registry 登录到Docker registry |
| logout | Log out from a Docker registry 从Docker registry注销 |
| logs | Fetch the logs of a container 获取容器的日志 |
| pause | Pause all processes within one or more containers 暂停一个或多个容器中的所有进程 |
| port | List port mappings or a specific mapping for the container 列出端口映射或容器的特定映射 |
| ps | List containers 容器列表 |
| pull | Pull an image or a repository from a registry 从registry中提取镜像或存储库 |
| push | Push an image or a repository to a registry 将映像或存储库推入registry |
| rename | Rename a container 容器重命名 |
| restart | Restart one or more containers 重启一个或多个容器 |
| rm | Remove one or more containers 移除一个或多个容器 |
| rmi | Remove one or more images 移除一个或多个镜像 |
| run | Run a command in a new container 在新容器中运行命令 |
| save | Save one or more images to a tar archive (streamed to STDOUT by default) 将一个或多个镜像保存到tar存档(默认情况下流到STDOUT) |
| search | Search the Docker Hub for images 在Docker Hub中搜索镜像 |
| start | Start one or more stopped containers 启动一个或多个停止的容器 |
| stats | Display a live stream of container(s) resource usage statistics 显示容器资源使用统计信息的实时流 |
| stop | Stop one or more running containers 停止一个或多个正在运行的容器 |
| tag | Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE 创建一个引用源镜像的目标镜像标记 |
| top | Display the running processes of a container 显示容器的运行进程 |
| unpause | Unpause all processes within one or more containers 在一个或多个容器中暂停所有进程 |
| update | Update configuration of one or more containers 更新一个或多个容器的配置 |
| version | Show the Docker version information 显示Docker版本信息 |
| wait | Block until one or more containers stop, then print their exit codes 阻塞,直到一个或多个容器停止,然后打印它们的退出代码 |
1.2、搜索镜像命令
语法: docker search [OPTIONS] TERM
选项:
| 选项 | 英文说明 | 中文说明 |
|---|---|---|
| -f, --filter filter | Filter output based on conditions provided | 根据提供的条件过滤输出 |
| --format string | Pretty-print search using a Go template | 使用Go模板进行漂亮的打印搜索 |
| --limit int | Max number of search results (default 25) | 最多搜寻结果数目(预设25个) |
| --no-trunc | Don't truncate output | 不截断输出 |
[root@Server ~]# docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 5945 [OK]
ansible/centos7-ansible Ansible on Centos7 128 [OK]
consol/centos-xfce-vnc Centos container with "headless" VNC session… 114 [OK]
jdeathe/centos-ssh OpenSSH / Supervisor / EPEL/IUS/SCL Repos - … 114 [OK]
centos/mysql-57-centos7 MySQL 5.7 SQL database server 74
imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 58 [OK]
tutum/centos Simple CentOS docker image with SSH access 45
centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 43
kinogmt/centos-ssh CentOS with SSH 29 [OK]
pivotaldata/centos-gpdb-dev CentOS image for GPDB development. Tag names… 11
guyton/centos6 From official centos6 container with full up… 10 [OK]
drecom/centos-ruby centos ruby 6 [OK]
centos/tools Docker image that has systems administration… 6 [OK]
pivotaldata/centos Base centos, freshened up a little with a Do… 4
pivotaldata/centos-mingw Using the mingw toolchain to cross-compile t… 3
pivotaldata/centos-gcc-toolchain CentOS with a toolchain, but unaffiliated wi… 3
mamohr/centos-java Oracle Java 8 Docker image based on Centos 7 3 [OK]
darksheer/centos Base Centos Image -- Updated hourly 3 [OK]
miko2u/centos6 CentOS6 日本語環境 2 [OK]
mcnaughton/centos-base centos base image 1 [OK]
blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK]
indigo/centos-maven Vanilla CentOS 7 with Oracle Java Developmen… 1 [OK]
pivotaldata/centos7-dev CentosOS 7 image for GPDB development 0
smartentry/centos centos with smartentry 0 [OK]
pivotaldata/centos6.8-dev CentosOS 6.8 image for GPDB development 0












网友评论