2017-05-12 22 views
0

這個星期我嘗試多克的第一次和遇到的與Windows 10.一些麻煩我就可以建立我的環境很容易在MacOS但不能在Windows 10無法看到在Windows 10多克的文件

我剛剛使用WebDevops的樣板(https://github.com/webdevops/php-docker-boilerplate)作爲初學者。在Windows 10上,如果我沒有創建默認機器,那麼Doc​​ker會使用MobyLinuxVM。我在我的文件夾中,不是C:驅動器,而是另一個名爲E:(我所有的驅動器都在Docker設置中共享),如果我做了一個簡單的docker-compose up -d,我可以訪問我的應用程序文件夾http://localhost:8000和PHPMyAdmin與http://localhost:8080

現在,如果我使用HyperV驅動程序創建一臺機器,將其設置爲默認機器,將其激活並創建一個docker-compose,我仍然可以訪問PHPMyAdmin和應用程序文件夾,但最後一個是空的!一個簡單的index.php文件不被解釋。

要創建一個機器,我做以下事情:

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 

這裏是我的搬運工,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 

沒有任何人有一個建議?任何幫助將非常感激!非常感謝!

回答

0

主機到虛擬機卷的安裝將不會與使用docker-machine創建的隨機虛擬機一起工作。它只會在使用Docker for Windows提供的安裝程序時才起作用(或者,如果您使用VirtualBox驅動程序在Windows上使用Docker Toolbox,但是您應該在Windows 10上繼續使用Docker for Windows)。

爲什麼要創建更多虛擬機,爲什麼需要將卷裝載到Windows主機的卷中?

+0

嗨!非常感謝您的回答!事實上,我想知道是否在我的計算機上創建更多機器來託管開發中的網站是一個好主意。但是如果我正確地理解了你的答案,那麼不創建額外的機器並保持MobyLinuxVM並通過本地主機訪問我的應用程序是更好的選擇,對吧? – LancelotKiin