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
相关推荐
少妇的美梦2 小时前
logstash教程
运维
容器魔方2 小时前
Bloomberg 正式加入 Karmada 用户组!
云原生·容器·云计算
chen9453 小时前
k8s集群部署vector日志采集器
运维
chen9453 小时前
aws ec2部署harbor,使用s3存储
运维
muyun28008 小时前
Docker 下部署 Elasticsearch 8 并集成 Kibana 和 IK 分词器
elasticsearch·docker·容器
東雪蓮☆8 小时前
深入理解 LVS-DR 模式与 Keepalived 高可用集群
linux·运维·服务器·lvs
qq_264220898 小时前
LVS负载均衡群集和LVS+Keepalived群集
运维·负载均衡·lvs
乌萨奇也要立志学C++8 小时前
【Linux】进程概念(二):进程查看与 fork 初探
linux·运维·服务器
雨落Liy8 小时前
Nginx 从入门到进阶:反向代理、负载均衡与高性能实战指南
运维·nginx·负载均衡
Nazi68 小时前
k8s的dashboard
云原生·容器·kubernetes