Skip to content

Instantly share code, notes, and snippets.

@KozhevnikovM
Last active December 27, 2022 10:00
Show Gist options
  • Save KozhevnikovM/383436fdcc1874787532f4163dcb2af9 to your computer and use it in GitHub Desktop.
Save KozhevnikovM/383436fdcc1874787532f4163dcb2af9 to your computer and use it in GitHub Desktop.
Systemd service for hashicorp vault. Use docker container
[Unit]
Description=HashiCorp Vault Service (Docker container)
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
Environment=VAULT_VERSION=1.11.3
Environment=VAULT_PORT=8200
ExecStartPre=-/usr/bin/docker exec vault stop
ExecStartPre=-/usr/bin/docker rm vault
ExecStartPre=/usr/bin/docker pull vault:${VAULT_VERSION}
ExecStart=/usr/bin/docker run --rm --name vault \
--cap-add=IPC_LOCK \
-v /opt/vault/config:/vault/config \
-v /opt/vault/file:/vault/file \
-v /opt/vault/logs:/vault/logs \
-e VAULT_ADDR="http://127.0.0.1:${VAULT_PORT}" \
-p ${VAULT_PORT}:${VAULT_PORT} \
vault:${VAULT_VERSION} server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment