docker-compose create nginx

docker-compose create nginx

####### docker-compose create nginx 
mkdir
-p composetest / nginx cd composetest cat >nginx/Dockerfile <<EOF FROM centos:6.8 WORKDIR /usr/src RUN yum install -y zlib-devel gd-devel pcre-devel pcre openssl-devel lua lua-devel gcc gcc-c++ wget RUN wget -q https://files.cnblogs.com/files/blog-lhong/nginx-1.0.8.tar.gz RUN wget -q https://files.cnblogs.com/files/blog-lhong/ngx_open.tar.gz RUN tar zxf ngx_open.tar.gz -C /usr/src/ RUN tar zxf nginx-1.0.8.tar.gz -C /usr/src/ WORKDIR /usr/src/nginx-1.0.8 RUN useradd -M -s /sbin/nologin nginx RUN ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --add-module=/usr/src/ngx_openresty/ngx_devel_kit --add-module=/usr/src/ngx_openresty/array-var-nginx-module --add-module=/usr/src/ngx_openresty/headers-more-nginx-module --add-module=/usr/src/ngx_openresty/rds-csv-nginx-module --add-module=/usr/src/ngx_openresty/auth-request-nginx-module --add-module=/usr/src/ngx_openresty/iconv-nginx-module --add-module=/usr/src/ngx_openresty/memc-nginx-module --add-module=/usr/src/ngx_openresty/rds-json-nginx-module --add-module=/usr/src/ngx_openresty/redis2-nginx-module --add-module=/usr/src/ngx_openresty/set-misc-nginx-module --add-module=/usr/src/ngx_openresty/echo-nginx-module --add-module=/usr/src/ngx_openresty/srcache-nginx-module --add-module=/usr/src/ngx_openresty/encrypted-session-nginx-module --add-module=/usr/src/ngx_openresty/form-input-nginx-module --add-module=/usr/src/ngx_openresty/xss-nginx-module --add-module=/usr/src/ngx_openresty/ngx_lua/ --with-http_ssl_module --add-module=/usr/src/ngx_openresty/ipseek --with-http_image_filter_module && make && make install RUN wget https://files.cnblogs.com/files/blog-lhong/ngservice.sh -O /etc/init.d/nginx RUN chmod 755 /etc/init.d/nginx RUN chkconfig --add nginx RUN egrep -v '#|^$' /usr/local/nginx/conf/nginx.conf.default >/usr/local/nginx/conf/nginx.conf RUN mkdir -p /usr/local/nginx/conf/conf.d && sed -i '/server {/ i include conf/conf.d\/\*.conf;' /usr/local/nginx/conf/nginx.conf RUN mkdir -p /data/html EXPOSE 80 CMD ["/usr/local/nginx/sbin/nginx","-g","daemon off;"] EOF ############################################## mkdir -p /data/nginx/{conf.d,html} cat >docker-compose.yml <<EOF version: "3" services: nginx: build: nginx/ ports: - "80:80" volumes: - /data/nginx/conf.d:/usr/local/nginx/conf/conf.d - /data/nginx/html:/data/html EOF ############################# docker-compose -f docker-compose.yml up -d ############################# building Mirror docker build composetest/nginx/ -t nginx:v1.0.8

 

Guess you like

Origin www.cnblogs.com/blog-lhong/p/11880759.html