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 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 ubuntu系统下挂载磁盘上执行./提示权限不够
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码