您好,登錄后才能下訂單哦!
這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)使用docker怎么制作分布式lnmp 鏡像,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
一、docker 分布式 lnmp 鏡像制作
#關(guān)閉防火墻及核心防護(hù) systemctl disable firewalld systemctl stop firewalld setenforce 0 #查看3306、80及9000端口是否被占用 ss -natp | grep 3306 ss -natp | grep 80 ss -natp | grep 9000 #創(chuàng)建自定義網(wǎng)絡(luò) docker network create -d bridge --subnet 172.168.184.0/24 --gateway 172.168.184.1 lnmp #運(yùn)行Nginx容器 docker run -itd --name nginx --network lnmp -p 80:80 --ip 172.168.184.10 nginx:1.12.0 #運(yùn)行MySQL容器 docker run -itd --name mysql --network lnmp -p 3306:3306 --ip 172.168.184.20 -e MYSQL_ROOT_PASSWORD=010230 mysql:5.7 #運(yùn)行PHP容器 docker run -itd --name phpfpm --network lnmp -p 9000:9000 --ip 172.168.184.30 php:7.1-fpm
docker exec -it nginx /bin/bash echo -e "server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htmi index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 172.168.184.30:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; include fastcgi_params; } }" > /etc/nginx/conf.d/default.conf nginx -s reload docker exec -it phpfpm /bin/bash mkdir -p /usr/share/nginx/html echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/index.php
虛擬機(jī)輸入localhost/index.php
本機(jī)輸入 192.168.184.70/index.php (我虛擬機(jī)地址是192.168.184.70)
上述就是小編為大家分享的使用docker怎么制作分布式lnmp 鏡像了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。