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
相关推荐
jieyu11197 分钟前
Linux Rootkit 详解
linux·运维·系统安全
宁檬精16 分钟前
运维面试准备——综合篇(一)
linux·运维·服务器
洛阳纸贵Coco.Leo.YI24 分钟前
10分钟在Windows11下Ubuntu内安装docker-Version28.51
linux·ubuntu·docker
dalianwawatou44 分钟前
云原生-k8s
云原生·容器·kubernetes
weixin_456904271 小时前
工业自动化通信控制
运维·struts·自动化
荣光波比1 小时前
K8S(四)—— Kubectl从入门到精通:K8s资源管理与项目生命周期实战指南
云原生·容器·kubernetes
荣光波比1 小时前
K8S(五)—— K8s中YAML文件全方位解析:语法、案例、Port详解与快速编写技巧
云原生·容器·kubernetes
帅帅梓2 小时前
nginx访问控制 用户认证 https
运维·nginx·https
b***25113 小时前
比斯特自动化|为什么焊接18650电池离不开点焊机?
运维·自动化
xgysimida3 小时前
一文搞懂supervisord是什么?
运维·运维开发