メモ
CentOS Linux release 7.5
Docker version 1.13.1
docker-compose version 1.21.2
shared/docker-compose.yml
version: "2"
services:
proxy:
image: jwilder/nginx-proxy
container_name: proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./certs:/etc/nginx/certs:ro
- /etc/nginx/vhost.d
- /usr/share/nginx/html
restart: always
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt
volumes:
- ./certs:/etc/nginx/certs
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes_from:
- proxy
restart: always
mysql:
image: mysql:5.7
container_name: mysql
command: >
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--max-allowed-packet=128M
ports:
- "3306:3306"
environment:
MYSQL_ROOT_USER: root
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mysql
volumes:
- ./mysql:/var/lib/mysql
restart: always
networks:
default:
external:
name: shared
redmine/docker-compose.yml
version: "2"
services:
redmine:
image: redmine
environment:
VIRTUAL_HOST: 〇〇.com
LETSENCRYPT_HOST: 〇〇.com
LETSENCRYPT_EMAIL: 〇〇@〇〇.com
REDMINE_DB_MYSQL: mysql
REDMINE_DB_DATABASE: redmine
REDMINE_DB_PASSWORD: root
external_links:
- mysql
restart: always
networks:
default:
external:
name: shared
docker network create --driver bridge shared
cd shared
docker-compose up -d
必要に応じてDB作成
docker-compose exec mysql bash
mysql -u root -p
mysql> CREATE DATABASE redmine;
redmineもup
cd redmine
docker-compose up -d
〇〇.comにアクセス
関連
docker、nginx-proxy、letsencrypt環境でlaravelするまで
docker、nginx-proxy、letsencrypt環境でwordpressするまで
参考
VPSにdockerで複数サイトをホスティングするには?
Docker上でnginx-proxy他を使ってSSL対応マルチドメインサーバ環境の構築