-
-
安全:面向安全的輕量發行版;
-
簡單:提供APK包管理工具,軟件的搜索、安裝、刪除、升級都非常方便。
-
適合容器使用
docker pull alpine
docker run -it --name myalpine alpine:v1
#查看官方alpine鏡像 docker search alpine #拉取鏡像 docker image pull itsthenetework/nfs-server-alpine # 導入nginx鏡像(推薦使用) docker load -i docker_nginx.tar.gz
2.
# 導入nginx鏡像(推薦使用) docker load -i docker_nginx.tar.gz
docker run -it -p 80:80 alpine:latest / # sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories / # apk update
安裝nginx
/ # apk add nginx / # mkdir /run/nginx / # nginx
return 404; #替換 root /html; index index.html;
提交成鏡像
docker commit <alpineID> nginx_alpine:v1 docker run -d -p 81:80 nginx_alpine:v1 nginx -g 'daemon off;'
docker run -it -p 80:80 alpine:v1 / # sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories / # apk update / # apk add nginx / # mkdir /run/nginx / # nginx / # apk add php7 php7-fpm php7-opcache php7-curl php7-gd php7-mbstring php7-mysqli php7-json php7-iconv php7-exif php7-ldap php7-pdo php7-session php7-xml
安裝 rc-service
apk add openrc --no-cache
啟動nginx
service nginx start
#或者rc-service nginx start
遇到問題
WARNING: nginx is already starting
/# service nginx status * You are attempting to run an openrc service on a * system which openrc did not boot. * You may be inside a chroot or you may have used * another initialization system to boot this system. * In this situation, you will get unpredictable results! * If you really want to do this, issue the following command: * touch /run/openrc/softlevel /# touch /run/openrc/softlevel touch: /run/openrc/softlevel: No such file or directory /# mkdir -p /run/openrc /# touch /run/openrc/softlevel /# service nginx status * status: stopped /# service nginx start * WARNING: nginx is already starting /# /sbin/openrc * Caching service dependencies ... [ ok ] /# rc-service nginx start * /run/nginx: creating directory * /run/nginx: correcting owner * Starting nginx ... [ ok ]
啟動php-fpm
vi /etc/php7/php-fpm.d/www.conf 所屬主和所著組為nginx /# service php-fpm7 start * Checking /etc/php7/php-fpm.conf ... * /run/php-fpm7: creating directory * Starting PHP FastCGI Process Manager ... [ ok ]
加入啟動服務
/# rc-update add nginx default
/# rc-update add php-fpm7 default
安裝可道雲
vim /etc/nginx/conf.d/default.conf server { listen 80 default_server; listen [::]:80 default_server; location / { root /html; index index.php index.html; include /etc/nginx/conf.d./*.conf; location ~ \.php$ { root /html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /html$fastcgi_script_name; include fastcgi_params; } } # You may need this to prevent return 404 recursion. location = /404.html { internal; } }
#檢查格式 nginx -t
創建站點目錄
mkdir /html cd /html wget http://static.kodcloud.com/update/download/kodexplorer4.40.zip chown -R nginx:nginx . #重啟nginx service nginx restart service php-fpm7 restart
啟動腳本文件
vim /init.sh service nginx start service nginx restart service php-fpm7 start service php-fpm7 restart tail -f /etc/hosts
docker commit optimistic_hermann alpine_kod:v1
驗證鏡像
docker run -d -p 80:80 alpine_kod:v1 /bin/sh /init.sh
登錄網站10.0.0.12:80
查看