安裝docker
- 參考美團云的一個教程--在CentOS上安裝Docker
- 如果遇到啟動服務(wù)時提示
WARN[0000] You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0.
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
docker: relocation error: docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
參考[這個文章](http://collabnix.com/archives/1012)
yum-config-manager –enable public_ol6_latest
yum install device-mapper-event-libs
添加阿里云docker鏡像加速器
sudo vim /etc/sysconfig/docker
// other_args="--registry-mirror=<your accelerate address>"
sudo service docker restart
sudo ps -ef | grep docker
配置redmine&mysql
-
鏡像選擇
- 官方的redmine鏡像可配置項較少蹦掐,選擇使用sameersbn/redmine
拉取鏡像
sudo docker pull sameersbn/redmine:3.3.2-1
sudo docker pull mysql:5.7.18
- 建立數(shù)據(jù)目錄
mkdir -p /where/ever/you/like/mysql
mkdir -p /where/ever/you/like/mysql-conf
mkdir -p /where/ever/you/like/redmine-data
- 安裝docker-compose
- 因為只安裝了1.7.1版的docker技羔,所以不能使用高版本的compose,只能用1.5.2配合version 1的yml文件使用
curl -L https://github.com/docker/compose/releases/download/1.5.2/docker-compose-
uname -s
-uname -m
> /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
- 修改compose配置
- 獲取基礎(chǔ)模板
wget https://raw.githubusercontent.com/sameersbn/docker-redmine/master/docker-compose.yml
-
修改配置笤闯。注意設(shè)定密碼堕阔。此處直接使用ROOT用戶給redmine使用。
另外颗味,使用QQ企業(yè)郵箱發(fā)送郵件超陆,端口要使用25,
SMTP_USER
要和之后redmine設(shè)置面板中的發(fā)件人保持一致浦马,否則會報501錯誤时呀。在映射的
/mnt/redmine/mysql-conf
路徑下添加xxx.cnf配置文件,保證mysql使用utf8mb4_unicode_ci
mysql.cnf
[mysqld]
collation-server = utf8mb4_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
skip-character-set-client-handshake
[client]
default-character-set = utf8
[mysql]
default-character-set = utf8
docker-compose.yml
mysql:
image: mysql:5.7.18
environment:
- MYSQL_ROOT_PASSWORD=xxx
- MYSQL_DATABASE=redmine-production
volumes:
- /where/ever/you/like/mysql:/var/lib/mysql
- /where/ever/you/like/mysql-conf:/etc/mysql/conf.d
redmine:
image: sameersbn/redmine:3.3.2-1
links:
- mysql
environment:
- TZ=Asia/Shanghai
- DB_ADAPTER=mysql2
- DB_HOST=mysql
- DB_PORT=3306
- DB_USER=root
- DB_PASS=xxx
- DB_NAME=redmine_production
- REDMINE_PORT=10083
- REDMINE_HTTPS=false
- REDMINE_RELATIVE_URL_ROOT=
- REDMINE_SECRET_TOKEN=
- REDMINE_SUDO_MODE_ENABLED=false
- REDMINE_SUDO_MODE_TIMEOUT=15
- REDMINE_CONCURRENT_UPLOADS=2
- REDMINE_BACKUP_SCHEDULE=
- REDMINE_BACKUP_EXPIRY=
- REDMINE_BACKUP_TIME=
- SMTP_ENABLED=true
- SMTP_METHOD=smtp
- SMTP_DOMAIN=exmail.qq.com
- SMTP_HOST=smtp.exmail.qq.com
- SMTP_PORT=25
- SMTP_USER=xxx@xxxxxx.com
- SMTP_PASS=xxxxx
- SMTP_STARTTLS=true
- SMTP_AUTHENTICATION=:login
ports:
- "9124:80"
volumes:
- /where/ever/you/like/redmine-data:/home/redmine/data
- 啟動docker container
docker-compose up //會自動根據(jù)配置更新container
-
iptables配置
- 如果默認的FORWARD規(guī)則是DROP的話晶默,需要添加
iptables -A FORWARD -i docker0 -j ACCEPT
- 查看iptables nat
sudo iptables -t nat -L -n
- 查看當(dāng)前iptables規(guī)則
sudo less /etc/sysconfig/iptables
- 如果重啟iptables的話會導(dǎo)致docker無法啟動容器
iptables: No chain/target/match by that name.
sudo service docker restart
- 配置nginx轉(zhuǎn)發(fā)請求
- sameersbn/redmine鏡像中已帶nginx谨娜,可以直接映射出80端口使用,也可以再轉(zhuǎn)接一層