Python私教张大鹏 Docker零基础入门教程

拉取Ubuntu18镜像

bash 复制代码
docker pull ubuntu:18.04

运行Ubuntu

bash 复制代码
docker run -it ubuntu:18.04 bash

查看镜像列表

bash 复制代码
docker images

添加镜像标签

bash 复制代码
docker tag ubuntu:18.04 myubuntu:18

获取镜像的详细信息

bash 复制代码
docker inspect ubuntu:18.04

查看Docker镜像各层创建历史

镜像文件由多个层组成,要知道各个层的具体内容,可以使用history命令,会列出各层的创建信息。

bash 复制代码
docker history ubuntu:18.04

搜索镜像

直接搜索:

bash 复制代码
docker search nginx

搜索官方镜像:

bash 复制代码
docker search --filter=is-official=true nginx

搜索收藏数超过4的TensorFlow镜像:

bash 复制代码
docker search --filter=stars=4 tensorflow

删除镜像

通过标签删除镜像:

bash 复制代码
docker rmi ubuntu:18.04

通过ID删除镜像:

bash 复制代码
docker rmi xxx

查看所有容器:

bash 复制代码
docker ps -a

删除容器:

bash 复制代码
docker rm xxx

强制删除镜像:

bash 复制代码
docker rmi -f ubuntu:18.04

导出镜像

bash 复制代码
docker save -o ubuntu18.tar.gz ubuntu:18.04

导入镜像

bash 复制代码
docker load -i ubuntu18.tar.gz

清理镜像

系统中可能会遗留临时的镜像文件,或者一直没有被使用的Docker镜像,通过以下命令自动清理镜像释放空间:

bash 复制代码
docker image prune -f
相关推荐
虎头金猫5 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
分布式存储与RustFS5 天前
MinIO 官方 Docker 镜像被移除:依赖它的项目该怎么办
docker·云原生·devops·对象存储·minio·分布式存储
AI职业加油站5 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
此冬歌咏5 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
玉&心5 天前
通过Arthas在线诊断K8S中的内存及JVM等使用情况
docker·k8s·arthas
xing-xing5 天前
Docker容器中Nginx站点根目录网页配置访问
nginx·docker
-梅5 天前
linux(8) 软硬链接
linux·运维·服务器
赵文宇(温玉)5 天前
CoreDNS的hosts插件的缺行配置导致k8s集群异常
容器·kubernetes·rancher
guo_wen_qiang5 天前
上传本地镜像到harbor中
docker·容器·持续部署
张洛闻Eren5 天前
k8s云原生【第十课】:水平 Pod 自动扩缩容
运维·数据库·云原生·kubernetes·github