码迷,mamicode.com
首页 > 数据库 > 详细

DockerFile部署lnmp+memcached+redis+mongodb开发环境for Nginx(一)

时间:2018-09-21 10:53:34      阅读:319      评论:0      收藏:0      [点我收藏+]

标签:repo   firewalld   端口   cat   Opens   centos   等等   技术   tar   

本文源链接地址:https://www.93bok.com

1、下载基础镜像centos
docker pull centos:6
2、查看一下大小
docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              6                   70b5d81549ec        2 months ago        195MB
3、创建文件夹存放Nginx的Dockerfile,以及源码包等等,为后期docker-compose做准备
mkdir -p /data/docker/lnmp-test/dockerfile/nginx
4、创建Mongodb的Dockerfile
vim /data/docker/lnmp-test/dockerfile/nginx/Dockerfile
FROM centos:6

LABEL maintainer="1012405802@qq.com" description="Nginx image"

ENV NGINX_VERSION 1.8.1

COPY 3rdPartyModules /root/3rdPartyModules

RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 && CONFIG="        --prefix=/usr/local/nginx         --conf-path=/etc/nginx/nginx.conf         --pid-path=/var/run/nginx.pid         --with-http_ssl_module         --user=nginx         --group=nginx         --error-log-path=/var/log/nginx/error.log         --http-log-path=/var/log/nginx/access.log         --http-client-body-temp-path=/usr/local/nginx/client_temp         --http-proxy-temp-path=/usr/local/nginx/proxy_temp         --http-fastcgi-temp-path=/usr/local/nginx/fastcgi_temp         --http-uwsgi-temp-path=/usr/local/nginx/uwsgi_temp         --http-scgi-temp-path=/usr/local/nginx/scgi_temp         --with-threads         --with-file-aio         --with-http_realip_module         --with-http_addition_module         --with-http_gunzip_module         --with-http_gzip_static_module         --add-module=/root/3rdPartyModules/echo-nginx-module-0.58/         --add-module=/root/3rdPartyModules/nginx-http-concat-1.2.2" && yum install -y                 gcc                 pcre-devel                 openssl-devel && groupadd nginx && useradd -s /sbin/nologin -M -g nginx nginx && tar -zxvf /root/3rdPartyModules/nginx-$NGINX_VERSION.tar.gz -C /root/3rdPartyModules/ && cd /root/3rdPartyModules/nginx-$NGINX_VERSION && ./configure $CONFIG && make -j $(getconf _NPROCESSORS_ONLN) && make install && mkdir -p /etc/nginx/conf.d && ln -s /usr/local/nginx/sbin/* /usr/local/sbin/ && chown -R nginx:nginx /usr/local/nginx/ && rm -rf /root/3rdPartyModules/ && yum clean all

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
5、把nginx源码包和扩展包上传到/data/docker/lnmp-test/dockerfile/nginx/目录下
6、创建镜像
cd /data/docker/lnmp-test/dockerfile/nginx/
docker build -t centos6:nginx .
7、查看镜像大小
docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos6             nginx               4a86f591315d        28 minutes ago      388MB
centos              6                   70b5d81549ec        2 months ago        195MB
8、启动容器测试是否成功
docker run -d -p 80:80 --name nginx centos6:nginx

技术分享图片

9、宿主机开启防火墙80端口
firewall-cmd --add-port=80/tcp --permanent
systemctl restart firewalld

DockerFile部署lnmp+memcached+redis+mongodb开发环境for Nginx(一)

标签:repo   firewalld   端口   cat   Opens   centos   等等   技术   tar   

原文地址:https://www.cnblogs.com/93bok/p/9684819.html

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