dsfsdf7852 2018-01-23 03:48 采纳率: 100%
浏览 145
已采纳

os.Lstat在基于ubuntu的Docker容器上的已装入卷中失败

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" \
    my-container

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?

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 socket通信实现多人聊天室疑惑
  • ¥15 DEV-C++编译缺失
  • ¥33 找熟练码农写段Pyhthon程序
  • ¥100 怎么让数据库字段自动更新
  • ¥15 antv g6 力导向图布局
  • ¥15 quartz框架,No record found for selection of Trigger with key
  • ¥15 锅炉建模+优化算法,遗传算法优化锅炉燃烧模型,ls-svm会搞,后面的智能算法不会
  • ¥20 MATLAB多目标优化问题求解
  • ¥15 windows2003服务器按你VPN教程设置后,本地win10如何连接?
  • ¥15 求一阶微分方程的幂级数