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
相关推荐
fengkai454510 小时前
Python运维
运维·python·监控·psutil·ipy
cpolar技术支持13 小时前
用一份 YAML 画出家里的网络拓扑:哪个口通公网、哪几个容器藏在内网,一张图摊开,再用 cpolar 在外网随时翻这份图
docker·网络拓扑·内网穿透·cpolar·yaml
无足鸟ICT14 小时前
【RHCA+】_proc_pid_task_
linux·运维·服务器
weixin_4046793116 小时前
cc 在 linux 安装
linux·运维·服务器
赤生云电竞16 小时前
算力调度系统架构实践:计费、配额与抢占策略设计——面向Kubernetes GPU集群的多租户治理
容器·系统架构·kubernetes
云上工程笔记17 小时前
大模型平台私有化部署怎么选?2026年合规要求、运维难度与架构成本评测
运维·架构
vivo互联网技术18 小时前
春节流量洪峰下的运维组织战:SRE 团队的春节保障实录
运维·运维开发·sre·组织协同
重生之小比特19 小时前
【Linux系统】22 线程概念与控制(上)
linux·运维
wno70419 小时前
Nginx代理MySQL或PG连接
运维·mysql·nginx