Welcome to Elvin's blog

docker 构建镜像 centos7 nginx php

 

#docker 构建镜像(Dockerfile)

  • centos 7.4.1078镜像制作
  • nginx镜像制作(以前面centos7镜像为基础)
  • Nginx+php镜像制作

更多操作实例,查看git里的readme文档

我的git网址 https://gitee.com/almi/docker

### 克隆文件到本目录
git clone https://gitee.com/almi/docker.git

### 构建镜像 almi/centos7 ,版本1708
cd docker
/1.centos7.4 #进入目录 docker build -t almi/centos7.4:1708 . docker images #查看镜像 ### 运行容器centos7-1,基于almi/centos7:1708镜像
docker run
--name centos7-1 -dit almi/centos7.4:1708 docker ps -l ### 进入容器
docker exec
-it centos7-1 /bin/sh ifconfig #查看ip地址 exit #退出,快捷键Ctrl+D ### 删除容器,删除镜像
docker
rm -f centos7-1 docker rmi almi/centos7.4:1708 #补充说明:构建文件centos-7.4.1708-docker.tar.xz来自docker官方
#
https://github.com/CentOS/sig-cloud-instance-images/tree/CentOS-7.4.1708

 

posted @ 2018-01-18 21:43  blog-elvin-vip  阅读(1803)  评论(0编辑  收藏  举报