Skip to content

Can not run docker under nobody:nogroup user because staking key/cert can't be created #949

@lcgogo

Description

@lcgogo

Describe the bug
I want to run avalanchego under nobody:nogroup by docker.
But the staking key/cert is always created by avalanchego automatically under /home even after add --staking-enabled false option

VER=1.6.5
docker run -it --name avalanchego-${VER} \
  --user nobody:nogroup \
  -v /data/avalanchego:/data/avalanchego \
  -p 9650:9650 -p 9651:9651 \
  avaplatform/avalanchego:v${VER} \
  /avalanchego/build/avalanchego \
  --db-dir /data/avalanchego \
  --chain-config-dir /data/avalanchego \
  --subnet-config-dir /data/avalanchego \
  --staking-enabled false --http-host 0.0.0.0
couldn't load node config: couldn't generate staking key/cert: couldn't create path for cert: mkdir /nonexistent: permission denied

To Reproduce
Steps to reproduce the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
截屏2021-11-12 下午12 17 20

Operating System
ubuntu 20.04

Additional context
I think need an option to define the homeDir instead of $HOME in config/flags.go and the db-dir chain-config-dir

// Results of parsing the CLI
var (
        defaultNetworkName     = constants.MainnetName
        homeDir                = os.ExpandEnv("$HOME")
        prefixedAppName        = fmt.Sprintf(".%s", constants.AppName)
        defaultDataDir         = filepath.Join(homeDir, prefixedAppName)

By submitting this issue I agree to the Terms and Conditions of the Developer Accelerator Program.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions