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

时间:2016-10-07 04:52:12

标签: docker docker-compose

这是撰写文件

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"

输出命令:

...............................................
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脚本,它们创建一个数据库并从转储文件导入到该数据库。 但它在窗口10中不起作用。

这些脚本在MAC OS,Ubuntu中运行良好,我使用的是docker 1.12.1。 我试图运行另一个具有相同配置和exec的容器到容器,但docker-entrypoint-initdb.d不包含我写的脚本。

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

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

enter image description here