镜像

1.获取镜像

  docker pull ubuntu:18.04

  docker pull ubuntu

2.使用images列出镜像

  docker images

3.使用tag添加镜像标签

  docker tag ubuntu:18.04 myubuntu:18.04

4.使用inspect查看详细信息

 docker inspect ubuntu:18.04

5.使用history查看镜像历史

 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

  

 

posted on 2019-08-28 14:26  happygril3  阅读(143)  评论(0)    收藏  举报

导航