Vault - Update Hashicorp Container (Part III)

After having my servers down for more than six months and building my Hashicorp Vault container ten months ago, it needs to be updated when back online.

Vault's documentation does not have an upgrade path but a few warnings before upgrading it.

1) Backup Vault

The first recommended step before upgrading is to back up your data since upgrades might change the data structure and make downgrades impossible.
In my installation, the data is under the folder file/ that can be backed up to an external folder.

2) Version Change

My container is a custom build, as shown in the previous articles(Part1 & Part2), and the versions of Linux Alpine and vault need to be updated in the Dockerfile. Although a phased approach is recommended, I am upgrading Vaul to the latest version changes as below.

FROM alpine:3.18.2

# This is the release of Vault to pull in.
ARG VAULT_VERSION=1.13.3

# Create a vault user and group first so the IDs get set the same way,
# even as the rest of this may change over time.
RUN addgroup vault && \
    adduser -S -G vault vault
...

3) Building The Container

Finally, the command below downloads the images and builds the container upgrading Vault to the latest version which is 1.13.3 at the time of this article writing.

docker build --no-cache --pull -t "vault:Dockerfile" .

References

Docker hub - Official Vault Container