Hi,
I've been using Vault for a while, but installed from the zip file. I'm now considering switching to a Docker deployment, so I've been trying out the official Vault container, following the docs at
https://hub.docker.com/_/vault/.
I'm not very experienced with Docker, so I may be doing something wrong; but things don't seem to work the way the docs suggest they should.
$ docker run --cap-add=IPC_LOCK -d --name=dev-vault vault
Unable to find image 'vault:latest' locally
latest: Pulling from library/vault
911c6d0c7995: Pull complete
118d396818d8: Pull complete
9e22bb68ced7: Pull complete
05617e4314c6: Pull complete
ce9fd536dbf3: Pull complete
Digest: sha256:af586d7f0ceb5b278673ef655bb688d299b031d07abbe157542011eeda48013e
Status: Downloaded newer image for vault:latest
8fc2302b86142bb0da1841738ee077b81f5fd1c577b9d7b82e4e11424a40a1b9
That's all fine.
The docs say:
The provided entry point script will also look for Vault subcommands and run vault with that subcommand. For example, you can execute docker run vault status and it will run the vault status command inside the container.
Let's try that:
$ docker run vault status
Couldn't start vault with IPC_LOCK. Disabling IPC_LOCK, please use --privileged or --cap-add IPC_LOCK
Does it need --cap-add again? Let's try that:
$ docker run --cap-add=IPC_LOCK vault status
So while it looks like vault status is being run, it's not connecting to the running Vault process. Do I need to do something to allow one Docker container to access another container? I suspect yes, but just following the Vault docs it doesn't mention it.
What about not trying to use the entry point script, but executing commands directly inside the container currently running Vault?
$ docker exec dev-vault vault status
Ah, that looks better. It's defaulted to HTTPS, but we can fix that:
Cluster Name vault-cluster-3d43f1ae
Cluster ID afb2f2c8-cf88-c13e-acb1-da7cef205b4b
Finally that looks like what I'm expecting to see from Vault.
As I said, it may be my unfamiliarity with Docker that's the problem; but just trying to follow along the Vault docs has been a bit frustrating, and I wonder whether other people have similar issues. Are there any other resources people can recommend for getting started with Vault using Docker? Or any other tips?
Thanks,
Tim