注意:以下文档只适用于TOP接口,请谨慎使用!

文档中心 > 云服务(EWS)说明

nginx镜像示例

更新时间:2017/05/05 访问次数:20811
文件名称 说明
dockfile docker镜像构建描述文件
start ews镜像启动脚本
check ews镜像健康检查脚本

制作nginx镜像的dockfile如下:

FROM registry.acs.aliyun.com/open/centos:3.0.0
COPY nginx-1.9.0.tar.gz /acs/user/nginx-1.9.0.tar.gz
#nginx
RUN cd /acs/user && tar xzf nginx-1.9.0.tar.gz && \ rm -fr nginx-1.9.0.tar.gz && \ cd /acs/user/nginx-1.9.0 && \ ./configure --prefix=/acs/user/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream && make && make install && \ rm -fr /acs/user/nginx-1.9.0 && \ echo "export PATH=$PATH:/ase/user/nginx/sbin:/acs/bin" > /root/.bash_profile && \ echo "export PATH=$PATH:/ase/user/nginx/sbin:/acs/bin" > /acs/user/.bash_profile COPY check /acs/bin/check COPY start /acs/bin/start

start脚本如下:

#!/bin/bash
env_file=/acs/conf/env.properties
if [ -f $env_file ];then 
    nginx_conf_file=`cat $env_file |grep -w nginx.conf.file |sed "s/^nginx.conf.file=//" `
        if [ "$nginx_conf_file" != "" ]; then
            wget -O /acs/user/nginx/conf/nginx.conf $nginx_conf_file
        fi 
fi
echo "################################### Start Nginx ###################################"
/acs/user/nginx/sbin/nginx -c /acs/user/nginx/conf/nginx.conf
if [ $? != 0 ]; then
    echo "Start nginx failed"
    exit 1
fi
echo "Start nginx success"
exit 0

check脚本如下

#!/bin/bash
if [ "`ps aux|grep nginx|grep -v grep|wc -l`" -gt 0 ];then
    echo "success"
    exit 0
fi
echo "failed"
exit 1

FAQ

关于此文档暂时还没有FAQ
返回
顶部