码迷,mamicode.com
首页 > 其他好文 > 详细

docker创建镜像

时间:2016-11-21 12:44:27      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:ldb   from   test   nginx   har   conf   base   color   mit   

手动创建:

docker run -d -p mynginx:v2 nginx
rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
yum install nginx -y
vi /etc/nginx/nginx.conf
daemon off;
docker ps -a
docker commit a823e15f958b oldboyedu/mynginx:v3
docker run -d -p 80:80 oldboyedu/mynginx:v3 nginx

 

用Dockerfile创建:

mkdir -p /opt/dockerfile/nginx
echo <h1>test index</h1> > index.html
[root@lanny nginx]# cat Dockerfile 
FROM centos
MAINTAINER lanny.ma iher@foxmail.com
WORKDIR /etc/yum.repos.d/
ADD CentOS-Base.repo /etc/yum.repos.d/
RUN rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
RUN yum install nginx -y
WORKDIR /etc/nginx
RUN echo daemon off; >> /etc/nginx/nginx.conf
ADD index.html /usr/share/nginx/html
VOLUME ["/etc/nginx"]
VOLUME ["/usr/share/nginx/html"]
VOLUME ["/var/www"]
EXPOSE 80 443
CMD ["nginx"]

 

docker build -t oldboyedu/mynginx:v4 /opt/dockerfile/nginx/
docker run -d -p 80:80 oldboyedu/mynginx:v4
docker ps -a

docker创建镜像

标签:ldb   from   test   nginx   har   conf   base   color   mit   

原文地址:http://www.cnblogs.com/iiiiher/p/6084962.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!