Docker 是一个开源的应用容器引擎
docker官方网站:https://hub.docker.com/
$部署docker到Linux系统
1.准备一个Linux系统的虚拟机或者物理机
本例所使用各版本:
虚拟机 VM : 15pro;
Linux系统 : Center OS 7;
远程操作软件 Xshell 6;
2.查询Linux的ip地址:ipconfig
3.使用Xshell连接Linux系统,并进入系统;
检查内核版本是否为3.10及其以上 命令:uname -r 如果不是将更新至最新
4.安装docker
输入 yum install docker (提示:必须空格)
显示如上信息选择 y ( 提示:yes)
等待安装完成。。
当显示 Complate!时安装完成
5.启动docker systemctl start docker
查看docker 版本 : docker -v
开启打开Linux系统并自动运行docker : systemctl enable docker
关闭docker : systemctl stop docker
6.下载镜像
查找相关镜像 :docker search 镜像名
安装相关镜像:docker pull 镜像名
查询镜像列表 : docker images
删除相关镜像 : docker rmi image_ID (image_ID 为镜像列表的镜像ID)
所下载的镜像已官方网站所提供的版本为主。不填写版本默认下载最新版本。
$.docker 容器操作
运行容器 :docker run --name 自定义名 -d 镜像名:tag
查询运行时的容器 :docker ps
删除容器(暂停运行的情况下) : docker rm 容器id
暂停运行容器 : docker stop 容器id
启动容器 : docker start 容器ID
查看未启动所有容器:docker ps -a
运行端口映射:docker run -d -p 虚拟机端口号:映射的端口号(8080)镜像名