shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

在Docker中难以运行

Open comzyh opened this issue 7 years ago • 0 comments

使用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

经查,https://github.com/sipt/shuttle/blob/e7b367e12827d4d81acb5deeb7d027b172215fb4/extension/config/config_path_linux.go#L10

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

如果ShuttleHomeDir变量仅在upgrade的时候使用,能否在upgrade的时候再手动调用相关函数,不写在init() 中? https://github.com/sipt/shuttle/blob/e7b367e12827d4d81acb5deeb7d027b172215fb4/extension/config/config_path.go#L12

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

comzyh avatar Dec 21 '18 19:12 comzyh