Hashicorp Vault Healthcheck command contains a typo resulting in failed results

James Gray
2022-08-08T16:17:34Z

## Summary

[Healthcheck instruction defined in the Dockerfile](https://repo1.dso.mil/dsop/hashicorp/vault/vault/-/blob/c2d878a0f22b85b75bd9b87b60b053a0daf589c7/Dockerfile#L23-24) contains a typo in the hostname, resulting in the health checks not being performed.

## Steps to reproduce

* Run the container without overriding the "healthcheck" instruction. This can be done in "dev" mode, for example:

```
docker run -d -p 8200:8200 ironbank/hashicorp/vault/vault:latest server -dev
```

* Inspect the container

## What is the current bug behavior?

Inspection of the container does not show any content for `State.Health` (see below for example).

## What is the expected correct behavior?

Inspection of the container should show a value for `State.Health.Status`, along with log entries containing the output of the most recent health check command executions.

## Relevant logs and/or screenshots

Example creation and inspection showing bug behaviour:

```
$ id=$(docker run -d -p 8200:8200 $MIRROR/ironbank/hashicorp/vault/vault:latest server -dev)
$ docker inspect --format='{{json .State.Health}}' $id
null
$ sleep 60
$ docker inspect --format='{{json .State.Health}}' $id
null
```

Example creation and inspection showing expected behaviour:

```
$ id=$(docker run -d -p 8200:8200 --health-cmd "curl -f http://localhost:8200/v1/sys/health?standbyok=true || exit 1" $MIRROR/ironbank/hashicorp/vault/vault:latest server -dev)
$ docker inspect --format='{{json .State.Health}}' $id
{"Status":"starting","FailingStreak":0,"Log":[]}
$ sleep 60
$ docker inspect --format='{{json .State.Health}}' $id
{"Status":"healthy","FailingStreak":0,"Log":[{"Start":"2022-08-04T10:37:16.713323925+10:00","End":"2022-08-04T10:37:16.76754591+10:00","ExitCode":0,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{\"initialized\":true,\"sealed\":false,\"standby\":false,\"performance_standby\":false,\"replication_performance_mode\":\"disabled\",\"replication_dr_mode\":\"disabled\",\"server_time_utc\":1659573436,\"version\":\"1.11.1\",\"cluster_name\":\"vault-cluster-6c4a5007\",\"cluster_id\":\"88b8123e-ce66-2d8c-644f-40afea2addba\"}\n\r100 295 100 295 0 0 288k 0 --:--:-- --:--:-- --:--:-- 288k\n"},{"Start":"2022-08-04T10:37:46.770186827+10:00","End":"2022-08-04T10:37:46.821843183+10:00","ExitCode":0,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 295 100 295 0 0 288k 0 --:--:-- --:--:-- --:--:-- 288k\n{\"initialized\":true,\"sealed\":false,\"standby\":false,\"performance_standby\":false,\"replication_performance_mode\":\"disabled\",\"replication_dr_mode\":\"disabled\",\"server_time_utc\":1659573466,\"version\":\"1.11.1\",\"cluster_name\":\"vault-cluster-6c4a5007\",\"cluster_id\":\"88b8123e-ce66-2d8c-644f-40afea2addba\"}\n"},{"Start":"2022-08-04T10:38:16.82474578+10:00","End":"2022-08-04T10:38:16.868978887+10:00","ExitCode":0,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 295 100 295 0 0 288k 0 --:--:-- --:--:-- --:--:-- 288k\n{\"initialized\":true,\"sealed\":false,\"standby\":false,\"performance_standby\":false,\"replication_performance_mode\":\"disabled\",\"replication_dr_mode\":\"disabled\",\"server_time_utc\":1659573496,\"version\":\"1.11.1\",\"cluster_name\":\"vault-cluster-6c4a5007\",\"cluster_id\":\"88b8123e-ce66-2d8c-644f-40afea2addba\"}\n"},{"Start":"2022-08-04T10:38:46.871912642+10:00","End":"2022-08-04T10:38:46.917630345+10:00","ExitCode":0,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 295 100 295 0 0 288k 0 --:--:-- --:--:-- --:--:-- 288k\n{\"initialized\":true,\"sealed\":false,\"standby\":false,\"performance_standby\":false,\"replication_performance_mode\":\"disabled\",\"replication_dr_mode\":\"disabled\",\"server_time_utc\":1659573526,\"version\":\"1.11.1\",\"cluster_name\":\"vault-cluster-6c4a5007\",\"cluster_id\":\"88b8123e-ce66-2d8c-644f-40afea2addba\"}\n"}]}
```

## Possible fixes

* Change the hostname in the [Healthcheck command](https://repo1.dso.mil/dsop/hashicorp/vault/vault/-/blob/c2d878a0f22b85b75bd9b87b60b053a0daf589c7/Dockerfile#L24) from `locahost` to `localhost`.
* While changes are being made to the healthcheck command, I would propose that the `--silent` argument is added to the `curl` call so that the logs in the inspection are more concise.

## Tasks
- [ ] Bug has been identified and corrected within the container