Docker容器中的应用如何访问Windows中的DB?

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?

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 \
  nginx:latest

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 \
  nginx:latest