鏡像

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

相關文章
相關標籤/搜索