实战脚本
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              725dcfab7d63        4 days ago          1.84kB
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS               NAMES
762d1ac4a047        hello-world         "/hello"            About a minute ago   Exited (0) About a minute ago                       determined_jepsen
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS               NAMES
68e0315cd817        hello-world         "/hello"            36 seconds ago       Exited (0) 35 seconds ago                           festive_albattani
0c63283c3e82        hello-world         "/hello"            About a minute ago   Exited (0) About a minute ago                       peaceful_archimedes
762d1ac4a047        hello-world         "/hello"            3 minutes ago        Exited (0) 3 minutes ago                            determined_jepsen
[root@localhost ~]# docker rm 68e0315cd817
68e0315cd817
[root@localhost ~]# docker rm 76
76
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
0c63283c3e82        hello-world         "/hello"            5 minutes ago       Exited (0) 5 minutes ago                       peaceful_archimedes
[root@localhost ~]# docker rm 0c
0c
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
b76e5a96b3b8        hello-world         "/hello"            3 seconds ago       Exited (0) 2 seconds ago                        elegant_perlman
781b717d7847        hello-world         "/hello"            6 seconds ago       Exited (0) 5 seconds ago                        epic_volhard
97ea81b0ddb8        hello-world         "/hello"            32 seconds ago      Exited (0) 30 seconds ago                       clever_ride
[root@localhost ~]# docker rm $(docker ps -a -q)
b76e5a96b3b8
781b717d7847
97ea81b0ddb8
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              725dcfab7d63        4 days ago          1.84kB
[root@localhost ~]# docker rmi 72
Untagged: hello-world:latest
Untagged: hello-world@sha256:0e06ef5e1945a718b02a8c319e15bae44f47039005530bc617a5d071190ed3fc
Deleted: sha256:725dcfab7d63ec87fa6fc5162ca0a36f67ad89cdfd7f9a156957b79d8b855368
Deleted: sha256:51d9ee0d3e49cf0d51e2149c89b0c428ed1151a7daecdcfaba8a3fc71ef3e8d0
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
[root@localhost ~]# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
9a0669468bf7: Pull complete
Digest: sha256:0e06ef5e1945a718b02a8c319e15bae44f47039005530bc617a5d071190ed3fc
Status: Downloaded newer image for hello-world:latest
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              725dcfab7d63        4 days ago          1.84kB
[root@localhost ~]# docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
b56ae66c2937: Pull complete
Digest: sha256:d6bfc3baf615dc9618209a8d607ba2a8103d9c8a405b3bd8741d88b4bef36478
Status: Downloaded newer image for alpine:latest
[root@localhost ~]# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
0ffadd58f2a6: Pull complete
Digest: sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0
Status: Downloaded newer image for busybox:latest
Status: Downloaded newer image for busybox:latest
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              725dcfab7d63        4 days ago          1.84kB
busybox             latest              6ad733544a63        4 days ago          1.13MB
alpine              latest              053cde6e8953        4 days ago          3.96MB
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
270ea45e5e17        hello-world         "/hello"            4 seconds ago       Exited (0) 2 seconds ago                       brave_wiles
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              725dcfab7d63        4 days ago          1.84kB
busybox             latest              6ad733544a63        4 days ago          1.13MB
alpine              latest              053cde6e8953        4 days ago          3.96MB
[root@localhost ~]# docker rmi 72
Error response from daemon: conflict: unable to delete 725dcfab7d63 (must be forced) - image is being used by stopped container 270ea45e5e17
[root@localhost ~]# docker rm 27
27
[root@localhost ~]# docker rmi 72
Untagged: hello-world:latest
Untagged: hello-world@sha256:0e06ef5e1945a718b02a8c319e15bae44f47039005530bc617a5d071190ed3fc
Deleted: sha256:725dcfab7d63ec87fa6fc5162ca0a36f67ad89cdfd7f9a156957b79d8b855368
Deleted: sha256:51d9ee0d3e49cf0d51e2149c89b0c428ed1151a7daecdcfaba8a3fc71ef3e8d0
[root@localhost ~]# docker rmi $(docker images -q)
Untagged: busybox:latest
Untagged: busybox@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0
Deleted: sha256:6ad733544a6317992a6fac4eb19fe1df577d4dec7529efec28a5bd0edad0fd30
Deleted: sha256:0271b8eebde3fa9a6126b1f2335e170f902731ab4942f9f1914e77016540c7bb
Untagged: alpine:latest
Untagged: alpine@sha256:d6bfc3baf615dc9618209a8d607ba2a8103d9c8a405b3bd8741d88b4bef36478
Deleted: sha256:053cde6e8953ebd834df8f6382e68be83adb39bfc063e40b0fc61b4b333938f1
Deleted: sha256:2aebd096e0e237b447781353379722157e6c2d434b9ec5a0d63f2a6f07cf90c2
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

docker的rm和rmi实战相关推荐

  1. Docker 镜像多阶段构建实战总结

    文章目录 Docker 镜像多阶段构建实战总结 一 背景 二 实践步骤 2.1 只通过一个 Dockerfile 来构建[方案一] 2.2 多个 Dockerfile 实现多阶段构建[方案二] 2.3 ...

  2. 史上最详细阿里云服务器上Docker部署War包项目 实战每一步都带详细图解!!!

    史上最详细阿里云服务器上Docker部署War包项目 实战每一步都带详细图解!!! 部署jar 包方式: https://blog.csdn.net/weixin_45821811/article/d ...

  3. 构建Docker镜像指南,含实战案例

    [Docker那些事]系列文章 Dockerfile 文件结构.docker镜像构建过程详细介绍 Dockerfile文件中CMD指令与ENTRYPOINT指令的区别 构建Docker镜像指南,含实战 ...

  4. Jenkins与Docker的自动化CI/CD实战

    一.发布流程设计 工作流程: 开发人员提交代码到Git版本仓库: Jenkins人工/定时触发项目构建: Jenkins拉取代码.代码编码.打包镜像.推送到镜像仓库: Jenkins在Docker主机 ...

  5. Docker 的数据持久化项目实战

    文章目录 官网 概述 初探Mysql镜像容器的数据存储 镜像准备:拉取mysql镜像 docker pull mysql 启动Mysql镜像 登录Mysql镜像容器 登录mysql 容器数据存储路径查 ...

  6. docker Swarm简介 新旧版本操作不一样docker run --rm swarm create和docker swarm --init

    https://www.cnblogs.com/franknihao/p/8490416.html https://cloud.tencent.com/developer/section/109194 ...

  7. docker run --rm

    先引用docker run命令的帮助文档原文: Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Run a command in a new ...

  8. 极客学院 Docker全面解读零基础实战(云盘下载)

    课程名称:  极客学院 Docker全面解读零基础实战 视频教程 课程简介:    非常系统的一套Docker视频教程,很全面的解读了Docker系统学习过程中各个重要知识点 可以作为一套入门级的Do ...

  9. 2019最新最全极客学院 Docker全面解读零基础实战

    课程名称:  极客学院 Docker全面解读零基础实战 视频教程 课程简介:     非常系统的一套Docker视频教程,很全面的解读了Docker系统学习过程中各个重要知识点 可以作为一套入门级的D ...

最新文章

  1. Html5游戏框架createJS组件--EaselJS
  2. springboot源码解析autoconfigure之WebMvcAutoConfiguration
  3. 解决pycharm安装包过程出现的问题:module 'pip' has no attribute 'main'
  4. 深入分析Volatile的实现原理
  5. 深入LINQ | 动态构建LINQ表达式
  6. Apache Pulsar:分布式发布订阅消息系统
  7. 程序员听歌该有的样子
  8. 怎样让计算机快速开机,怎样设置可以让电脑快速启动开机.doc
  9. tf.train.GradientDescentOptimizer().minimize()细致探索
  10. loj #6013. 「网络流 24 题」负载平衡
  11. 网络编程_手写聊天室_群聊过渡板
  12. 3dsMax建模,卡线学习笔记
  13. RUOK的完整形式是什么?
  14. Spring Security OAuth2.0 认证协议【15】实现QQ第三方登录
  15. 配置ntpd提供网络授时服务
  16. 牛客刷题<19>使用3-8译码器实现逻辑函数
  17. 和女友一起学技术,她去了字节,我去了华为
  18. 使用ubuntu遇到的问题-An error occurred,please run Package Manager...
  19. 【毕业设计】深度学习卫星遥感图像检测与识别系统(目标检测)
  20. AP微观和宏观经济学考察重点分析

热门文章

  1. 3.7V转3V,5V转3V的热门升降压芯片和LDO
  2. python数字大小写转换代码_【经验分享】20个Python代码段,好用到哭!
  3. 不同行业数据分析思路5
  4. 数据字典标准与统一的重要性(码表枚举值)
  5. 【Tools】Windows电脑网线直连iperf测试
  6. 麻省理工数学与计算机科学,美国留学MIT学子M专访
  7. 树梅派3B红外、433315全连接及家居智能控制(四)SSH菜单控制篇
  8. jeecgboot中,修改请求方式加入阻止重复请求的方法。
  9. 爆火!ChatGPT背后的这类芯片赢麻了!
  10. Python统计字符/单词/汉字个数(字典)的三种方法