eccube-4.2.1 を Docker Compose でインストール (MySQL)

Ubuntu 22.10 を使いました。

ドッカーのインストール

```bash
sudo snap install docker
```

バージョンの確認

```text
$ sudo docker version
Client:
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.18.10
 Git commit:        100c70180f
 Built:             Tue Mar  7 06:29:35 2023
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.10
  Git commit:       a89b842
  Built:            Tue Mar  7 06:30:14 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
```

ソースコードの取得

```bash
git clone https://github.com/EC-CUBE/ec-cube.git
```

インストール

```bash
cd ec-cube/
sudo docker-compose -f docker-compose.yml -f docker-compose.mysql.yml up -d
```

インストール後の Docker の状況

```text
$ sudo docker ps
CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS                    PORTS                                                                                  NAMES
34ea46d5f477   ghcr.io/ec-cube/ec-cube-php:8.1-apache   "docker-php-entrypoi…"   19 minutes ago   Up 19 minutes (healthy)   0.0.0.0:8080->80/tcp, :::8080->80/tcp, 0.0.0.0:4430->443/tcp, :::4430->443/tcp         ec-cube_ec-cube_1
3696604954d2   mysql:5.7                                "docker-entrypoint.s…"   20 minutes ago   Up 20 minutes (healthy)   33060/tcp, 0.0.0.0:13306->3306/tcp, :::13306->3306/tcp                                 ec-cube_mysql_1
a82d8e62c3be   schickling/mailcatcher                   "sh -c 'mailcatcher …"   20 minutes ago   Up 20 minutes             0.0.0.0:1025->1025/tcp, :::1025->1025/tcp, 0.0.0.0:1080->1080/tcp, :::1080->1080/tcp   ec-cube_mailcatcher_1
```

## フロント画面
http://localhost:8080/
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/179446/01fb2550-4eab-1fc0-ac51-1cca7fcae558.png)

## 管理画面
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/179446/7c8ccdb9-3256-ef5d-8883-6bbd78ca2a87.png)

設定 -> システム情報
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/179446/efd02680-91e1-156c-b7c5-06986e87b576.png)

## データベースのコンテナにアクセス

```text
$ sudo docker exec -it ec-cube_mysql_1 bash
bash-4.2# mysql -udbuser -psecret eccubedb
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 617
Server version: 5.7.41 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.41    |
+-----------+
1 row in set (0.00 sec)

mysql> exit
Bye
bash-4.2#
```

## Web サーバーのコンテナにアクセス

```text
$ sudo docker exec -it ec-cube_ec-cube_1 bash
root@34ea46d5f477:/var/www/html# apache2 -v
Server version: Apache/2.4.54 (Debian)
Server built:   2022-06-09T04:26:43
```