2019-02-27 08:34
浏览 134


OS: Windows server 2016

I have an App wrote in Go and put in a docker container. The App has to access "D:\test.db". How can I do that?

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

OS:Windows Server 2016

我有一个用Go语言编写的应用, 放在docker容器中。 该应用程序必须访问“ D:\ test.db”。 我该怎么办?

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

1条回答 默认 最新

  • duanbi2760 2019-02-27 08:36

    Using docker volumes and by using the -v or --mount flag when you start your container.

    A modified example from the Docker docs:

    $ docker run -d \
      --mount source=myvol2,target=/app \

    you just need to replace nginx:latext with your image name and adapt source and target as you need.

    Another example (also from the docs) using -v and mounting in read-only mode:

    $ docker run -d \
      -v nginx-vol:/usr/share/nginx/html:ro \
    解决 无用
    打赏 举报

相关推荐 更多相似问题