公式の Docker イメージを使用して Redmine を docker-compose で動かしてみます。
データベースは MySQL を使用します。
理由は、現在 Bitnami Redmine を使用しており、そこからの移行を目的としているためです。
docker-compose.yml
とりあえず作成した docker-compose.yml は以下です。
version: '2'
services:
redmine:
image: redmine
restart: always
ports:
- 3000:3000
environment:
- REDMINE_DB_MYSQL=mysql
- REDMINE_DB_PASSWORD=example
volumes_from:
- redmine-datastore
redmine-datastore:
container_name: redmine-datastore
image: busybox
volumes:
- /usr/src/redmine/files
mysql:
container_name: redmine-mysql
image: mysql
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: redmine
volumes_from:
- mysql-datastore
mysql-datastore:
container_name: redmine-mysql-datastore
image: busybox
volumes:
- /var/lib/mysql
後述しますが、MySQL については文字コードを変更しないとエラーが表示されます。
MySQL の文字コードを変更
Redmine に管理者でログイン後、管理メニューでデフォルト設定がロードできますが、当初ここで以下のようなエラーが表示されました。
デフォルト設定がロードできませんでした: Mysql2::Error: Incorrect string value:
調べたところ、これは MySQL の文字コードに起因しているようです。
なので、MySQL の文字コードを変更します。
docker-compose.yml の中の以下のコードが文字コードを変更している箇所です。
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
参考 URL
- https://hub.docker.com/_/redmine/
- http://simota.hatenablog.jp/entry/2016/07/03/000023
- https://qiita.com/nexkeh/items/02a4d6c33d884bda1b23
- https://www.ainoniwa.net/pelican/2016/1120a.html
- https://blog.leko.jp/post/how-to-use-redmine-with-docker-in-japanese/
- https://qiita.com/neko-neko/items/de8ea13bbad32140de87
- https://qiita.com/astrsk_hori/items/1e683a7a2f2b7189cb6e
- https://github.com/sameersbn/docker-redmine/blob/master/docker-compose.yml