doujie7497 2019-02-26 17:21
浏览 85
已采纳

Docker - 在Mac上编写安装卷文件,但不在PC上

I am using docker-compose to mount run a docker image with php:7.0-apache and mount my files to /var/www/html. When I run docker-compose up everything builds fine. When I visit localhost:8080 on a mac I am able to view the site as it should appear. When I visit on windows it says 403 forbidden - You don't have permission to access / on this server. Apache/2.4.25 (Debian) Server at localhost Port 8080. Please help I need this to run on windows machine.

docker-compose.yml

version: '3'
services:
  web: 
    container_name: ves-corporate-site
    build:
      context: .
      dockerfile: ./.docker/Dockerfile
    volumes:
      - ./dist:/var/www/html
    ports:
      - "8080:80"

Dockerfile

FROM php:7.0-apache

# Run Linux apt (Advanced Package Tool) to and install any packages
RUN apt-get update && \
    apt-get install -y --no-install-recommends
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
# Enable mod_rewrite in apache modules
RUN a2enmod rewrite

File structure

/
  .docker/
      Dockerfile
  dist/
      index.php
      (many-other .php files)
  docker-compose.yml

No files are mounted in /var/www/html when I use docker-compose exec web bash to check them.

docker-compose exec web bash
ls

On a Mac I see my full working directory though.

Diving in further I have found my apache2.conf in my container at

etc/apache2/apache2.conf

In it I found this. This make sense to why it won't let me mount my files right? However When I update it to allow me I am unsure of next steps. How to I restart apache and the container while keeping my changes to allow me write to to /var/www/html. In some dire need of instruction, please help thanks.

<Directory />
    Options FollowSymLink
    AllowOverride None
    Order allow, deny
</Directory>
  • 写回答

1条回答 默认 最新

  • dongshan1036 2019-02-27 19:15
    关注

    After a long time experimenting I discovers that the files weren't' being mounted form my docker-compose file. By following these steps I was able to fix the issue and was able to mount files again.

    1. Open Docker settings from the system tray
    2. Select Shared Drives
    3. Un-select C drive and apply
    4. Re-select C drive and apply
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:我知道这个问题对你们来说肯定so easy
  • ¥15 wpf datagrid如何实现多层表头
  • ¥15 为啥画版图在Run DRC会出现Connect Error?可我Calibre的hostname和计算机的hostname已经设置成一样的了。
  • ¥20 网站后台使用极速模式非常的卡
  • ¥20 Keil uVision5创建project没反应
  • ¥15 mmseqs内存报错
  • ¥15 vika文档如何与obsidian同步
  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography