获取 Ubuntu 18.04 系统的基础镜像

docker pull ubuntu:18.04

创建容器并运行 bash 应用

docker run -it ubuntu:18.04 bash

docker run -it ubuntu:18.04 /bin/bash

使用 tag 命令添加镜像标签

docker tag ubuntu:18.04 php74:latest

使用 inspect 命令查看详细信息

docker inspect php74:latest

docker inspect -f {{".RepoTags"}} php74:latest

使用 history 命令查看镜像历史

docker history php74:latest --no-trunc

搜寻镜像

docker search --filter=is-official=true nginx

删除镜像

docker rmi php74:latest

自动清理临时的遗留镜像文件层

docker image prune -f

删除所有无用镜像,不光是临时镜像

docker image prune -a -f

基于已有容器创建

docker  commit 6f2e41b21d70