Docker Window无法将窗口中的文件夹挂载到容器中

Docker Window can't mount a folder from window to container

这是撰写文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
version: '2'

services:  
  finsify-postgres:
    image: postgres:9.5.4
    # init database and user
    environment:
      - POSTGRES_PASSWORD=32014a0c
      - POSTGRES_USER=postgres
      - POSTGRES_DB=postgres
    volumes:
      - ./postgres-initdb/dump:/tmp/dump
      - ./postgres-initdb/scripts:/docker-entrypoint-initdb.d
    ports:
      -"3101:5432"  
  finsify-redis:
    image: redis:3.2.3
    ports:
      -"3001:6379"

输出命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...............................................
finsify-postgres_1  | waiting for server to start....LOG: database system was shut down at 2016-10-07 04:07:24 UTC
finsify-postgres_1  | LOG: MultiXact member wraparound protections are now enabled
finsify-postgres_1  | LOG: database system is ready to accept connections finsify-postgres_1  | LOG:  autovacuum launcher started
finsify-postgres_1  | done
finsify-postgres_1  | server started
finsify-postgres_1  | ALTER ROLE
finsify-postgres_1  |
finsify-postgres_1  |
finsify-postgres_1  | /docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
finsify-postgres_1  |
finsify-postgres_1  | LOG: received fast shutdown request
finsify-postgres_1  | LOG: aborting any active transactions
finsify-postgres_1  | LOG: autovacuum launcher shutting down
finsify-postgres_1  | LOG: shutting down
finsify-postgres_1  | waiting for server to shut down....
finsify-postgres_1  | LOG:  database system is shut down
finsify-postgres_1  | done
finsify-postgres_1  | server stopped ............

在docker entrypoint initdb.d中,有两个bash脚本,它们创建一个数据库并从dump文件导入到此数据库。但它在10号窗口不起作用。

这些脚本在MacOS、Ubuntu中运行良好,我使用Docker 1.12.1。我尝试用相同的config和exec-to-container运行另一个容器,但docker entrypoint initdb.d没有包含我编写的脚本。

谢谢你的帮助。


这很可能是因为您没有共享项目所在的C驱动器。这是需要的,因为使用了VirtualBox,默认情况下不能访问您的驱动器。

enter image description here