聲明:本文不是完整的案例,只是對裏面關鍵的環節進行記錄
- 設置目錄掛載
docker run --rm --name nginx-test -p 8080:80 -d nginx
mkdir -p /home/nginx/www /home/nginx/logs /home/nginx/conf
docker cp 358354f206fd:/etc/nginx/. /home/nginx/conf/
docker run --rm -d -p 8081:80 --name nginx-test-web \
-v /home/nginx/www:/usr/share/nginx/html \
-v /home/nginx/conf/:/etc/nginx/ \
-v /home/nginx/logs:/var/log/nginx \
nginx
- 啓動多個測試容器進行測試
docker run --name=f9 --restart=always -p 10009:80 -d t6
docker run --name=f8 --restart=always -p 10008:80 -d t6
- 配置負載均衡策略
cd