2018-01-23 03:48
浏览 125


I have a docker container that uses go-bindata to compile a config. I run the docker container with

docker run -id \
    -v conf:/conf \
    -e CONF="/conf" \

Then in the docker container, I install go-bindata, and run

RUN go-bindata -prefix $CONF -o $GOPATH/src/github.com/my/repo/dir/conf_generated.go $CW_CONF/config

And the output is

bindata: Failed to stat input path '/conf/config': lstat /conf/config: no such file or directory

This is the line that is causing the error. It is odd because when I enter the container and run the same command, it works. stat /conf/config also works (it knows the file is there). What is going on here? Why doesn't the install line work when the container is building?

图片转代码服务由CSDN问答提供 功能建议

我有一个使用 go-bindata 编译配置的docker容器。 我使用

  docker运行docker容器-id \
 -v conf:/ conf \
 -e CONF =“ / conf” \


  RUN go-bindata- 前缀$ CONF -o $ GOPATH / src / github.com / my / repo / dir / conf_genic.go $ CW_CONF / config 


  bindata:无法统计输入路径'/ conf / config':lstat / conf / config:没有这样的文件或目录
 \  n 

是 导致错误。 这很奇怪,因为当我进入容器并运行相同的命令时,它可以工作。 stat / conf / config 也可以工作(它知道文件在那里)。 这里发生了什么? 为什么在构建容器时安装行不起作用?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongxian1921 2018-01-23 10:09

    It looks like you have the bindata call declared in your Dockerfile. With the RUN prefix it's executed during build of the container when there is no volume yet mounted. If you use the CMD prefix it will run during execution of the container, then the volume is mounted and it should work.

    解决 无用
    打赏 举报

相关推荐 更多相似问题