redmine centOS上で Redmineをコンテナ化して動かす - maki51/CentOS GitHub Wiki
https://docs.docker.com/engine/install/centos/
Uninstall old versions
Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.
# sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
Installation methods
Set up the repository Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.
# sudo yum install -y yum-utils
# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker Engine
Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
# sudo yum install docker-ce docker-ce-cli containerd.io
If prompted to accept the GPG key, verify that the fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it.
~~実行結果~~
==============================================================================================================
Package アーキテクチャー
バージョン リポジトリー 容量
==============================================================================================================
インストール中:
containerd.io x86_64 1.4.12-3.1.el7 docker-ce-stable 28 M
docker-ce x86_64 3:20.10.12-3.el7 docker-ce-stable 23 M
docker-ce-cli x86_64 1:20.10.12-3.el7 docker-ce-stable 30 M
依存性関連でのインストールをします:
audit-libs-python x86_64 2.8.5-4.el7 base 76 k
checkpolicy x86_64 2.5-8.el7 base 295 k
container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k
docker-ce-rootless-extras x86_64 20.10.12-3.el7 docker-ce-stable 8.0 M
docker-scan-plugin x86_64 0.12.0-3.el7 docker-ce-stable 3.7 M
fuse-overlayfs x86_64 0.7.2-6.el7_8 extras 54 k
fuse3-libs x86_64 3.6.1-4.el7 extras 82 k
libcgroup x86_64 0.41-21.el7 base 66 k
libsemanage-python x86_64 2.5-14.el7 base 113 k
policycoreutils-python x86_64 2.5-34.el7 base 457 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.8-4.el7 base 620 k
slirp4netns x86_64 0.4.3-4.el7_8 extras 81 k
トランザクションの要約
==============================================================================================================
インストール 3 パッケージ (+13 個の依存関係のパッケージ)
合計容量: 95 M
インストール容量: 387 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-cli-20.10.12-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
https://download.docker.com/linux/centos/gpg から鍵を取得中です。
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <[email protected]>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download.docker.com/linux/centos/gpg
~~ここまで実行結果~~
This command installs Docker, but it doesn’t start Docker. It also creates a docker group, however, it doesn’t add any users to the group by default.
To install a specific version of Docker Engine, list the available versions in the repo, then select and install:
a. List and sort the versions available in your repo. This example sorts results by version number, highest to lowest, and is truncated:
# yum list docker-ce --showduplicates | sort -r
b. Install a specific version by its fully qualified package name, which is the package name (docker-ce) plus the version string (2nd column) starting at the first colon (:), up to the first hyphen, separated by a hyphen (-). For example, docker-ce- 3:20.10.9-3.el7
# sudo yum install docker-ce-3:20.10.9-3.el7 docker-ce-cli-3:20.10.9-3.el7 containerd.io
Start Docker.
# sudo systemctl start docker
Verify that Docker Engine is installed correctly by running the hello-world image.
# sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.
~~実行結果~~
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:507ecde44b8eb741278274653120c2bf793b174c06ff4eaa672b713b3263477b
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
~~ここまで実行結果~~
https://docs.docker.com/compose/install/
Prerequisites Docker Compose relies on Docker Engine for any meaningful work, so make sure you have Docker Engine installed either locally or remote, depending on your setup.
Install Compose On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub. Follow the instructions from the link, which involve running the curl command in your terminal to download the binaries. These step-by-step instructions are also included below. Run this command to download the current stable release of Docker Compose:
# sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Apply executable permissions to the binary:
# sudo chmod +x /usr/local/bin/docker-compose
Test the installation.
# docker-compose --version
DockerでRedmineを構築する方法
docker-compose.ymlを作成
# mkdir /usr/local/redmine
# cd /usr/local/redmine
# vi docker-compose.yml
docker-compose.ymlに以下を記述 ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
Default
version: '3.8'
services:
redmine:
image: redmine
container_name: redmine
ports:
- 3000:3000
volumes:
- ./data/plugins:/usr/src/redmine/plugins
- ./data/themes:/usr/src/redmine/public/themes
environment:
REDMINE_DB_MYSQL: redmine-db
REDMINE_DB_PASSWORD: redmine
depends_on:
- redmine-db
restart: always
redmine-db:
image: mariadb
container_name: redmine-db
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: redmine
MYSQL_DATABASE: redmine
volumes:
- ./data/db:/var/lib/mysql
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
restart: always
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
Redmineのコンテナを起動
※docker-compose.ymlファイルがあるディレクトリ上で実行してください。 # docker-compose up -d
~~実行結果~~
Creating network "redmine_default" with the default driver
Pulling redmine-db (mariadb:)...
latest: Pulling from library/mariadb
ea362f368469: Downloading [=================================================> ] 28.26MB/28.57MB
adb9a1b1379d: Download complete
ac5c95406850: Download complete
fa48d8b47ec1: Download complete
bcf1feb44ac3: Download complete
8a5de7784a0f: Download complete
b8724b8a281a: Download complete
a8a7c3f612d6: Download complete
39b09b59e889: Downloading [=====================> ] 37.72MB/87.28MB
14bc3a6b0a94: Download complete
Digest: sha256:5a37e65a6414d78f60d523c4ddcf93d715854337beb46f8beeb1a23d83262184
Status: Downloaded newer image for mariadb:latest
Pulling redmine (redmine:)...
latest: Pulling from library/redmine
5eb5b503b376: Pull complete
fdff106a7aee: Pull complete
95ddd5adb14c: Pull complete
cefeb08339d9: Pull complete
b250965928cf: Pull complete
fa946d71d577: Pull complete
d252e371c78f: Pull complete
797c48ad542c: Pull complete
7327addbfa1c: Pull complete
56e2c56e97dd: Pull complete
0c983f749e86: Pull complete
952daee29c5e: Pull complete
Digest: sha256:5a153104369447326023037d367a0643931b1d541c854a5ac733b738a32b6e63
Status: Downloaded newer image for redmine:latest
~~ここまで実行結果~~
起動確認
# docker-compose ps
~~実行結果~~ redmine /docker-entrypoint.sh rail ... Up 0.0.0.0:3000->3000/tcp,:::3000->3000/tcp redmine-db docker-entrypoint.sh mysql ... Up 0.0.0.0:3306->3306/tcp,:::3306->3306/tcp ~~ここまで実行結果~~
起動が確認できれば、Remineコンテナの構築は完了です。
- GUIでの基本操作
GUI画面への接続とログイン http://<IPアドレス>:3000に接続し、画面右上の「ログイン」からログインします。 ※初期ユーザーは、ID、パスワードともに「admin」です