Nginxを利用
(参考)https://hub.docker.com/_/nginx/
起動
# docker run --name some-nginx -d -p 80:80 nginx
起動したコンテナへbashする
# docker exec -it some-nginx bash
ファイルをアップ
# ls -l /tmp/content/ total 8 -rw-r--r-- 1 root root 684 Jul 4 02:01 index_blue.html -rw-r--r-- 1 root root 686 Jul 4 02:01 index_green.html # # docker cp /tmp/content/index_blue.html some-nginx:/usr/share/nginx/html/index.html -> BLUEの画面になる # docker cp /tmp/content/index_green.html some-nginx:/usr/share/nginx/html/index.html -> GREENの画面になる
HTMLファイルのディレクトリをマウントする
# docker run --name some-nginx -v /tmp/content:/usr/share/nginx/html:ro -d -p 80:80 nginx
2つのコンテナを起動する。
BLUE用
docker run --name blue --hostname blue -d -p 81:80 nginx docker cp /tmp/content/index_blue.html blue:/usr/share/nginx/html/index.html
GREEN用
docker run --name green --hostname green -d -p 82:80 nginx docker cp /tmp/content/index_green.html green:/usr/share/nginx/html/index.html
Proxy用
docker run --name proxy-nginx --hostname proxy-nginx -v /tmp/work/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx