如何初始化 stack.yaml 中定义的新数据库路径

How do I initialize a new database-path defined in stack.yaml

stack.yaml 的示例 Docker configuration 部分给出:

  # Location of database used to track image usage, which `stack docker cleanup`
  # uses to determine which images should be kept.  On shared systems, it may
  # be useful to override this in the global configuration file so that
  # all users share a single database.
  database-path: "~/.stack/docker.db"

然而,当我将其放入新项目的 stack.yamlstack setup 时,我得到:

Aeson exception:
Error in $.docker['database-path']: failed to parse field 'docker': failed to parse field 'database-path': InvalidAbsFile "~/.stack/docker.db"
See http://docs.haskellstack.org/en/stable/yaml_configuration/

这是 only reference I could finddatabase-path,无需深入研究代码。

是否需要database-path

如果是这样:如何初始化 .db 文件(以缓解 InvalidAbsFile "~/.stack/docker.db")?

不是数据库初始化的问题。问题是它没有扩展~,所以你需要使用/home/dukedave/.stack/docker.db