Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Vault in rootless docker container #237

Open
dzieciou opened this issue Jul 26, 2021 · 1 comment
Open

Vault in rootless docker container #237

dzieciou opened this issue Jul 26, 2021 · 1 comment

Comments

@dzieciou
Copy link

dzieciou commented Jul 26, 2021

I'm trying to run Vault in container using root-less docker on Ubuntu 20.2. However, I keep getting the following error:

vault    | Error initializing core: Failed to lock memory: cannot allocate memory
vault    |
vault    | This usually means that the mlock syscall is not available.

The problem does not occur when running a container with docker having root privileges.

Is there a way to provide root-less docker with privileges for mlock?

docker-compose.yml:

version: "3"
services:
  vault:
    image: "hashicorp/vault:1.8.0-rc2"
    user: "root"
    container_name: vault
    restart: on-failure:10
    volumes:
      - ./config:/vault/config:rw
      - ./file:/vault/file:rw
    ports:
      - 8200:8200
    cap_add:
      - IPC_LOCK
    environment:
      - VAULT_ADDR=http://0.0.0.0:8200
    command: vault server -config=/vault/config

config.hcl:

storage "file" {
  path    = "/vault/file"
}

listener "tcp" {
  address     = "0.0.0.0:8200"
  tls_disable = "true"
}

api_addr = "http://127.0.0.1:8200"
ui = true
@aphorise
Copy link

Did you try disabling mlock?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants