1.获取镜像python
docker pull ubuntu:18.04git
docker pull ubuntugithub
2.使用images列出镜像docker
docker imagesubuntu
3.使用tag添加镜像标签ui
docker tag ubuntu:18.04 myubuntu:18.04get
4.使用inspect查看详细信息it
docker inspect ubuntu:18.04io
5.使用history查看镜像历史test
docker history ubuntu:18.04
6.删除镜像
没有容器运行:使用标签/id删除镜像: docket rmi ubuntu:18.04
有容器运行:(1)强制删除镜像:docket rmi -f ubuntu:18.04
(2) 先删除容器id,再删除镜像id:docker rm container_id docker rmi image_id
7.清理镜像
docker image prune -f
8.建立镜像(Dockerfile)
(1)建立Dockerfile文件
FROM debian:stretch-slim
LABEL version="1.0" maintainer="docker user <docker_user@github>"
RUN apt-get update
RUN apt-get install -y python3
RUN apt-get clean
(2)docker build -t python:3
9.镜像保存
docker save -o ubuntu_18.04.tar ubuntu:18.04
10.加载镜像
docker load -i ubuntu_18.04.tar
11.上传镜像
docker tag test:latest user/test:latest
docker push user/test:latest