1. 현재버전 확인
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                      NAMES
6833f559d95f        nginx:1.17-alpine   "/bin/sh -c 'while :…"   6 weeks ago         Up 13 days          0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   nginx
582a783bd357        certbot/certbot     "/bin/sh -c 'trap ex…"   6 weeks ago         Up 6 weeks          80/tcp, 443/tcp                            nginx-certbot_certbot_1
d7f23a5d5b7d        ghost:3.7           "docker-entrypoint.s…"   6 weeks ago         Up 6 weeks          2368/tcp                                   ghost

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               1.18-alpine         ab94f84cc474        7 weeks ago         21.3MB
ghost               3.7                 e78340d8fd63        2 months ago        392MB
certbot/certbot     latest              ce913a50e000        3 months ago        164MB

2. 신규 버전 확인

$ curl -s https://registry.hub.docker.com/v1/repositories/ghost/tags | sed "s/,/\n/g" | grep name | cut -d '"' -f 4

...
3.20
3.20-alpine
3.20.0
3.20.0-alpine
3.3
...

3. 업그레이드 3.7 -> 3.20 (설치전 데이터 백업 필수)

ubuntu@hibuz:~/nginx-certbot$ vi docker-compose.yml
version: '3'

services:
  ghost:
    image: ghost:3.20


ubuntu@hibuz:~/nginx-certbot$ docker-compose up -d
Creating network "nginx-certbot_default" with the default driver
Pulling ghost (ghost:3.20)...
3.20: Pulling from library/ghost
8559a31e96f4: Pull complete
cd8ab664fcca: Pull complete
73933e8417ef: Pull complete
2d6a6e4a4338: Pull complete
1587625fe5c3: Pull complete
85ca8327bb56: Pull complete
31d46880945d: Pull complete
2efe792fb3e6: Pull complete
9a3f196e1042: Pull complete
Digest: sha256:d1da414e8c6b0bc025ed705c2352a76703fc65f1ef6ae1b10ff09cc00edef02a
Status: Downloaded newer image for ghost:3.20
Creating nginx-certbot_certbot_1 ... done
Creating ghost                   ... done
Creating nginx                   ... done

4. 업그레이드 확인

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ghost               3.20                913adb142818        12 hours ago        425MB
nginx               1.18-alpine         ab94f84cc474        7 weeks ago         21.3MB
ghost               3.7                 e78340d8fd63        3 months ago        392MB
certbot/certbot     latest              ce913a50e000        5 months ago        164MB

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                      NAMES
06b4386aafc5        nginx:1.18-alpine   "/bin/sh -c 'while :…"   3 minutes ago       Up 3 minutes        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   nginx
8b62dc993d18        ghost:3.20          "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes        2368/tcp                                   ghost
25dcfbe96c7f        certbot/certbot     "/bin/sh -c 'trap ex…"   3 minutes ago       Up 3 minutes        80/tcp, 443/tcp                            nginx-certbot_certbot_1