KUSANAGI Runs on Dockerでコンテナイメージをアップデートする

前回の記事『[VultrでKUSANAGI Runs on Dockerが動くまで（その4）](https://qiita.com/chiruparu/items/64e7895c6ebac2cdabdd)』ではVPC環境であるVultrにKUSANAGI RoD環境を構築し、リバプロサーバとしてhttps-portal環境を作りました。
今回はKUSANAGI Runs on Dockerのコンテナイメージをアップデートしたいと思います。

KUSANAGI RODで使っているコンテナのうち以下コンテナでアップデートがありました。

* [kusanagi-nginx:1.19.3-r0](https://hub.docker.com/r/primestrategy/kusanagi-nginx)
* [kusanagi-php:7.4.9-r0](https://hub.docker.com/r/primestrategy/kusanagi-php)
* [mariadb:10.5.6-focal](https://hub.docker.com/_/mariadb)

docker-compose.ymlファイルを更新します。

```dockerfile:docker-compose.yml
version: '3'

networks:
  default:
    driver: bridge
    driver_opts:
      com.docker.network.driver.mtu: 9000
  shared-network:
    external: true

services:
  httpd:
    container_name: kusanagi01_httpd
    #image: primestrategy/kusanagi-nginx:1.17.9-r0
    image: primestrategy/kusanagi-nginx:1.19.3-r0
    restart: always
    env_file:
      - .kusanagi
      - .kusanagi.httpd
    volumes:
      - kusanagi:/home/kusanagi
      #- kusanagi:/etc/letsencrypt
      #- kusanagi:/var/www/html/.well-known
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
    #ports:
      #- "8080:8080"
      #- "8443:8443"
    extra_hosts:
      - "fqdn:127.0.0.1"
    networks:
      - shared-network

        #certbot:
        #container_name: kusanagi01_certbot
        #image: certbot/certbot:v1.6.0
        #restart: always
        #network_mode: "service:httpd"
        #env_file:
        #- .kusanagi.httpd
        #volumes:
        #- kusanagi:/var/www/html/.well-known
        #- kusanagi:/etc/letsencrypt
        #command:
        #- --version

## CONFIG
  config:
    container_name: kusanagi01_config
    restart: always
    build:
        context: ./wpcli
    user: "1000:1001"
    env_file:
      - .kusanagi
      - .kusanagi.wp
      - .kusanagi.db
    volumes:
      - database:/var/run/mysqld
      - kusanagi:/home/kusanagi
    command: wp --version

  php:
    container_name: kusanagi01_php
    #image: primestrategy/kusanagi-php:7.4.8-r0
    image: primestrategy/kusanagi-php:7.4.9-r0
    restart: always
    env_file:
      - .kusanagi
      - .kusanagi.php
      - .kusanagi.mail
    network_mode: "service:httpd"
    volumes:
      - database:/var/run/mysqld
      - kusanagi:/home/kusanagi
      - ./php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini

## MYSQL 
  db:
    container_name: kusanagi01_db
    #image: mariadb:10.5.4-focal
    image: mariadb:10.5.6-focal
    restart: always
    user: "999:999"
    env_file:
      - .kusanagi.mysql
    network_mode: "service:httpd"
    volumes:
      - database:/var/run/mysqld
      - database:/var/lib/mysql
 
## FTPD
  ftp:
    container_name: kusanagi01_ftp
    image: primestrategy/kusanagi-ftpd:1.0.2-r1
    restart: always
    network_mode: "service:httpd"
    env_file:
      - .kusanagi
      - .kusanagi.wp
    volumes:
      - kusanagi:/home/kusanagi


volumes:
  kusanagi:
  database:
```


dockerコマンドでコンテナを再作成します。

```bash
$ docker-compose stop
$ docker-compose up -d
Pulling httpd (primestrategy/kusanagi-nginx:1.19.3-r0)...
1.19.3-r0: Pulling from primestrategy/kusanagi-nginx
df20fa9351a1: Already exists
5af32d8d47ac: Pull complete
e55c96c86184: Pull complete
936d68b47fc1: Pull complete
a8c682723ffa: Pull complete
03145aaddb69: Pull complete
497c91cb4efa: Pull complete
639014dd9611: Pull complete
804c2b55bd45: Pull complete
8ba2747f59ab: Pull complete
2d3ef1c004b5: Pull complete
151010cd7bea: Pull complete
7368eee41ec2: Pull complete
054bb2aec8f7: Pull complete
c2cbc49740f5: Pull complete
Digest: sha256:00c7d727578796793afb9e02c006f631119f5f778c304b71d71308dc81661d8c
Status: Downloaded newer image for primestrategy/kusanagi-nginx:1.19.3-r0
Pulling php (primestrategy/kusanagi-php:7.4.9-r0)...
7.4.9-r0: Pulling from primestrategy/kusanagi-php
df20fa9351a1: Already exists
b358d6dbbdff: Already exists
0232d962484c: Already exists
0c1d3ac04d2a: Already exists
69251dafcb2d: Pull complete
f1f538119c59: Pull complete
cfbff98e6534: Pull complete
c2aadec4cc8c: Pull complete
b2ed7d8627c3: Pull complete
a5f68329b27f: Pull complete
e2a454f2222e: Pull complete
f3b64d79d270: Pull complete
11d91a2e79d9: Pull complete
86b38ba94154: Pull complete
928fdca444e9: Pull complete
37da8ddee44c: Pull complete
de5ab4f13129: Pull complete
7b2c6c5559bf: Pull complete
be5013ba038f: Pull complete
45921131dc11: Pull complete
d84b8c09a0dc: Pull complete
Digest: sha256:954b368151a8d255411e0722c246976dd79bb9cb2438584cca253978c542e4bc
Status: Downloaded newer image for primestrategy/kusanagi-php:7.4.9-r0
Pulling db (mariadb:10.5.6-focal)...
10.5.6-focal: Pulling from library/mariadb
d72e567cc804: Pull complete
0f3630e5ff08: Pull complete
b6a83d81d1f4: Pull complete
4bf2111ecf0e: Pull complete
9572d64978a0: Pull complete
bcc9953bffb3: Pull complete
de429570dda5: Pull complete
3652bc6ea9f9: Pull complete
6e4bf87041c8: Pull complete
96e489d6af27: Pull complete
baaf018282fc: Pull complete
1cca1ca0b2da: Pull complete
Digest: sha256:3e6a64c089460fb3403b5d3458ace9710d0be94f3dfdaaaeb74945dbb8e5671c
Status: Downloaded newer image for mariadb:10.5.6-focal
Starting kusanagi01_config  ... done
Recreating kusanagi01_httpd ... done
Recreating kusanagi01_php   ... done
Recreating kusanagi01_ftp   ... done
Recreating kusanagi01_db    ... done

$ docker-compose ps
      Name                     Command                 State            Ports       
------------------------------------------------------------------------------------
kusanagi01_config   docker-entrypoint.sh wp -- ...   Restarting                     
kusanagi01_db       docker-entrypoint.sh mysqld      Up                             
kusanagi01_ftp      /bin/sh -c /docker-entrypo ...   Up                             
kusanagi01_httpd    /docker-entrypoint.sh /usr ...   Up           8080/tcp, 8443/tcp
kusanagi01_php      /usr/local/bin/docker-entr ...   Up
```