一:镜像和容器的定义:
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

四:基于容器新建镜像,镜像的导入导出

浙公网安备 33010602011771号