Skip to content

在Docker中难以运行 #73

Description

@comzyh

使用Alpine镜像启动会提示

panic: user: Current not implemented on linux/amd64

goroutine 1 [running]:
github.com/sipt/shuttle/extension/config.init.0()
	/Users/sipt/Documents/GOPATH/src/github.com/sipt/shuttle/extension/config/config_path.go:17 +0x20f

经查,

u, err := user.Current()

user.Current() 依赖 "$USER" 环境变量,一般docker环境并无这个环境变量,所以会报错;

如果ShuttleHomeDir变量仅在upgrade的时候使用,能否在upgrade的时候再手动调用相关函数,不写在init() 中?

同时给出一个临时的解决方法:
在Docker container 中添加一个环境变量USER=root

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions