
Docker常用命令
发布日期:2021-05-10 06:12:44
浏览次数:7
分类:技术文章
本文共 3159 字,大约阅读时间需要 10 分钟。
1.帮助命令
笔记整理来源 B站UP主
docker version #显示docker的版本信息。docker info #显示docker的系统信息,包括镜像和容器的数量docker 命令 --help #帮助命令
2.镜像命令
docker images #查看所有本地主机上的镜像 可以使用docker image ls代替docker search xxx #搜索xxxx镜像docker pull #下载镜像 docker image pulldocker rmi #删除镜像 docker image rmdocker rmi -f 镜像id #删除指定id的镜像[root@iz2zeak7sgj6i7hrb2g862z ~]# docker rmi -f f19c56ce92a8docker rmi -f $(docker images -aq) #删除全部的镜像[root@iz2zeak7sgj6i7hrb2g862z ~]# docker stop $(docker ps -a -q)

3.容器命令
注意:要有了镜像才可以创造容器
docker run 镜像id #新建容器并启动docker ps 列出所有运行的容器 docker container listdocker rm 容器id #删除指定容器docker start 容器id #启动容器docker restart 容器id #重启容器docker stop 容器id #停止当前正在运行的容器docker kill 容器id #强制停止当前容器
docker命令大全
attach Attach local standard input, output, and error streams to a running container #当前shell下 attach连接指定运行的镜像 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 #查看docker容器的变化 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归档文件[对应import] history Show the history of an image # 展示一个镜像形成历史 images List images #列出系统当前的镜像 import Import the contents from a tarball to create a filesystem image #从tar包中导入内容创建一个文件系统镜像 info Display system-wide information # 显示全系统信息 inspect Return low-level information on Docker objects #查看容器详细信息 kill Kill one or more running containers # kill指定docker容器 load Load an image from a tar archive or STDIN #从一个tar包或标准输入中加载一个镜像[对应save] login Log in to a Docker registry # logout Log out from a 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 push Push an image or a repository to a 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) search Search the Docker Hub for images 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 wait Block until one or more containers stop, then print their exit codes
转载地址:https://blog.csdn.net/weixin_43145539/article/details/113891643 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2023年12月10日 11时43分28秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
归并排序模板
2019-03-28
Birthday Gift
2019-03-28
Nitori and Stack-Tech
2019-03-28
电话列表(前缀树,字典树 典例)
2019-03-28
前缀统计(前缀树、字典树 附典例)
2019-03-28
前缀树(字典树)模板,附典例
2019-03-28
倒水(贪心)
2019-03-28
购物(贪心)
2019-03-28
蓝桥杯--16进制转化为8进制(大数)
2019-03-28
二分查找 & 二分答案 万字详解,超多例题,带你学透二分!!
2019-03-28
二分查找 & 二分答案 ,课后练习题答案。
2019-03-28
金牌厨师HiLin与HJGG(二维前缀 + 二分!)
2019-03-28
Subsequences Summing to Sevens( 前缀和+小技巧!)
2019-03-28
Angry Cows(二分答案——好题!)
2019-03-28
K-clearing(map容器!)
2019-03-28
排队(小思维题)
2019-03-28
双端队列_01bfs——附详解典例!
2019-03-28
floyd——记录路径,原理详解!
2019-03-28
二叉树——根据先序(后序)、中序 建树! 超详讲解!
2019-03-28
二叉树——根据 中序 和 层序 建树! 超详讲解!
2019-03-28