在Windows 10上无法使用Docker查看文件

本周我第一次尝试了Docker,并在Windows 10中遇到了一些麻烦。我可以在macOS上很容易地设置我的环境,但是在Windows 10上却不能。

我刚刚使用WebDevops的样板( https://github.com/webdevops/php-docker-boilerplate )作为初学者。 在Windows 10上,如果我没有创build一个默认的机器,Docker使用MobyLinuxVM。

在我的文件夹,这是不是C:驱动器,但在另一个名为E:(我所有的驱动器在Docker设置共享),如果我做一个简单的docker-compose up -d ,我可以访问我的应用程序文件夹http:// localhost:8000和PHPMyAdmin, http:// localhost:8080 。

现在,如果我使用HyperV驱动程序创build一台机器,将其设置为默认机器,激活它并创build一个docker-compose,我仍然可以访问PHPMyAdmin和app文件夹,但最后一个是空的! 一个简单的index.php文件不解释。

要创build一台机器,我做了以下几件事情:

 docker-machine create --driver hyperv --hyperv-virtual-switch "Primary Virtual Switch" default docker machine env default & "C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe" env default | Invoke-Expression 

这是我的docker-compose.yml文件:

 version: '2' services: ####################################### # PHP application Docker container ####################################### app: build: context: . dockerfile: Dockerfile.development links: - mail - mysql #- postgres #- solr #- elasticsearch #- redis #- memcached #- ftp ports: - "8000:80" - "8443:443" - "10022:22" volumes: - ./app/:/app/ - ./:/docker/ volumes_from: - storage # cap and privileged needed for slowlog cap_add: - SYS_PTRACE privileged: true env_file: - etc/environment.yml - etc/environment.development.yml environment: - VIRTUAL_HOST=.app.boilerplate.docker - VIRTUAL_PORT=80 - POSTFIX_RELAYHOST=[mail]:1025 ####################################### # MySQL server ####################################### mysql: build: context: docker/mysql/ #dockerfile: MySQL-5.5.Dockerfile dockerfile: MySQL-5.6.Dockerfile #dockerfile: MySQL-5.7.Dockerfile #dockerfile: MariaDB-5.5.Dockerfile #dockerfile: MariaDB-10.Dockerfile #dockerfile: Percona-5.5.Dockerfile #dockerfile: Percona-5.6.Dockerfile #dockerfile: Percona-5.7.Dockerfile ports: - 13306:3306 volumes_from: - storage env_file: - etc/environment.yml - etc/environment.development.yml ####################################### # PostgreSQL server ####################################### #postgres: # build: # context: docker/postgres/ # dockerfile: Postgres-9.4.Dockerfile # dockerfile: Postgres-9.5.Dockerfile # ports: # - 15432:5432 # volumes_from: # - storage # env_file: # - etc/environment.yml # - etc/environment.development.yml ####################################### # Solr server ####################################### #solr: # build: # context: docker/solr/ # volumes_from: # - storage # env_file: # - etc/environment.yml # - etc/environment.development.yml # environment: # - SOLR_STORAGE=/storage/solr/server-master/ # - VIRTUAL_HOST=solr.boilerplate.docker # - VIRTUAL_PORT=8983 ####################################### # Elasticsearch ####################################### #elasticsearch: # build: # context: docker/elasticsearch/ # ports: # - 19200:9200 # - 19300:9300 # volumes_from: # - storage # env_file: # - etc/environment.yml # - etc/environment.development.yml # environment: # - VIRTUAL_HOST=elasticsearch.boilerplate.docker # - VIRTUAL_PORT=9200 ####################################### # Redis ####################################### #redis: # build: # context: docker/redis/ # volumes_from: # - storage # env_file: # - etc/environment.yml # - etc/environment.development.yml ####################################### # Memcached ####################################### #memcached: # build: # context: docker/memcached/ # volumes_from: # - storage # env_file: # - etc/environment.yml # - etc/environment.development.yml ####################################### # Mail ####################################### # Mailhog mail: image: mailhog/mailhog # ports: # - 8025:8025 environment: - VIRTUAL_HOST=mail.boilerplate.docker - VIRTUAL_PORT=8025 # Mailcatcher #mail: # image: schickling/mailcatcher # environment: # - VIRTUAL_HOST=mail.boilerplate.docker # - VIRTUAL_PORT=1080 # Mailsandbox #mail: # image: webdevops/mail-sandbox # environment: # - VIRTUAL_HOST=mail.boilerplate.docker # - VIRTUAL_PORT=80 ####################################### # FTP (vsftpd) ####################################### #ftp: # build: # context: docker/vsftpd/ # volumes_from: # - storage # volumes: # - ./:/application/ # env_file: # - etc/environment.yml # - etc/environment.development.yml ####################################### # phpMyAdmin ####################################### phpmyadmin: image: phpmyadmin/phpmyadmin links: - mysql environment: - PMA_HOSTS=mysql - VIRTUAL_HOST=pma.boilerplate.docker - VIRTUAL_PORT=80 ports: - "8080:80" volumes: - /sessions ####################################### # Storage ####################################### storage: build: context: docker/storage/ volumes: - /storage 

有人有build议吗? 任何帮助将非常感激! 非常感谢!

主机到虚拟机卷的安装将无法使用docker-machine创build的随机虚拟docker-machine 。 它只会在使用Docker for Windows提供的安装程序时才起作用(或者,如果您使用VirtualBox驱动程序在Windows上使用Docker Toolbox,但是您应该在Windows 10上使用Docker for Windows)。

为什么要创build更多的虚拟机,为什么需要将卷装入Windows主机?