飞行的猪哼哼

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

一:镜像和容器的定义:
1:镜像:
一个打包好了的系统镜像文件(这个系统里面已经有人提前安装好了一些应用/服务)
2:容器:
基于一个系统镜像,运行起来的操作系统(该运行操作系统里面,提供什么服务,取决于系统镜像提前安装了什么服务)

二:镜像的基础操作:
2.1: 查看docker本地镜像:
docker images 或者 docker image ls

python@ubuntu:~$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              f949e7d76d63        11 months ago       126MB
delron/fastdfs      latest              8487e86fc6ee        2 years ago         464MB

python@ubuntu:~$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              f949e7d76d63        11 months ago       126MB
delron/fastdfs      latest              8487e86fc6ee        2 years ago         464MB

2.2 :从官方镜像站下载镜像:
docker image pull <镜像名>:<版本号>

$  docker image pull ubuntu:16.04

2.3:本地导入镜像:一般该镜像由他的作者配置的,该镜像里面到底安装了什么,作者清楚。
docker image load -i <镜像压缩文件>

2.4:删除本地镜像:
docker image rm <镜像的id> 或 docker image rm <镜像名>:<版本号>

三:容器的基础操作:
在使用nginx:latest镜像操作的时候,为了避免和宿主机ubuntu的nginx冲突,把宿主机ubuntu中的nginx关闭:systemctl stop nginx

在这里插入图片描述
四:基于容器新建镜像,镜像的导入导出
在这里插入图片描述

posted on 2020-09-08 20:55  飞行的猪哼哼  阅读(26)  评论(0)    收藏  举报