docker启动容器

方式1 
#!/usr/bin/env bash

NGINX_PID_FILE=/var/run/nginx.pid

if [ -f "/custom-env-and-nginx-init.sh" ]
then
    source /custom-env-and-nginx-init.sh
fi

stop_nginx() {
    echo "Stopping nginx..."
    PID=$(cat "$NGINX_PID_FILE")
    /bin/kill -s TERM $PID
    exit
}

trap stop_nginx INT TERM
/usr/sbin/nginx -g "daemon off;" &
NGINX_PID=$!
wait "$NGINX_PID"


#!/usr/bin/env bash

NGINX_PID_FILE=/var/run/nginx.pid

if [ -f "/custom-env-and-nginx-init.sh" ]
then
    source /custom-env-and-nginx-init.sh
fi

stop_nginx() {
    echo "Stopping nginx..."
    PID=$(cat "$NGINX_PID_FILE")
    /bin/kill -s TERM $PID
    exit
}

trap stop_nginx INT TERM

/usr/sbin/nginx -g "daemon off;" &

wait 




方式2 
#!/usr/bin/env bash

NGINX_PID_FILE=/var/run/nginx.pid

if [ -f "/custom-env-and-nginx-init.sh" ]
then
    source /custom-env-and-nginx-init.sh
fi

stop_nginx() {
    echo "Stopping nginx..."
    PID=$(cat "$NGINX_PID_FILE")
    /bin/kill -s TERM $PID
    exit
}

trap stop_nginx INT TERM
exec /usr/sbin/nginx -g "daemon off;"

CoreSecurityCommon-1076131302-260526-2112-16 conv 1

CoreSecurityCommon-1076131302-260526-2112-16 conv 2

CoreSecurityCommon-1076131302-260526-2112-16 conv 3

CoreSecurityCommon-1076131302-260526-2112-16 conv 4

CoreSecurityCommon-1076131302-260526-2112-16 conv 5

CoreSecurityCommon-1076131302-260526-2112-16 conv 6

CoreSecurityCommon-1076131302-260526-2112-16 conv 7

CoreSecurityCommon-1076131302-260526-2112-16 conv 8

 

posted on 2026-05-26 21:17  小镇-做题家  阅读(13)  评论(0)    收藏  举报

导航