ds355020 2016-01-27 18:48
浏览 241

Docker(NGINX,PHP,mySQL)和Windows - 文件权限

I've been looking into docker for a few hours; I'm running Windows 8.1 as the host machine, and VirtualBox with boot2docker.

This is my docker-compose.yml:

mysql:
    image: mysql
    ports: 
        - "6603:3306"    
    environment:
        MYSQL_ROOT_PASSWORD: mysql
        MYSQL_USER: mysql
fpm:
    image: php:7.0.2-fpm
    volumes:
        - /c/Users/Administrator/www:/var/www/html
    ports:
        - "9000:9000"
    links:
        - mysql
nginx:
    image: nginx 
    ports:
        - "80:80"
        - "443:443"
    volumes:
        - /c/Users/Administrator/www:/var/www/html
    links:
        - fpm

This works fine (I can go to my docker ip address and see the nginx welcome page); although when I run mkdir for example (through php) it will give an error regarding windows permissions.

  • 写回答

2条回答

  • duanlian1978 2016-01-27 19:31
    关注

    You should use volumes tag instead of volumes_from

    • volumes can mount directories from host machine to container and
    • volumes_from mounts directories from other services or containers

    Please look at docker-compose file documentation

    And your docker-compose file should look like this:

    fpm:
        image: php:7.0.2-fpm
        volumes:
            - /c/Users/Administrator/www:/var/www/html
        ports:
            - "9000:9000"
        links:
            - mysql
    nginx:
        image: nginx 
        ports:
            - "80:80"
            - "443:443"
        volumes_from:
            - fpm
        links:
            - fpm
    
    评论

报告相同问题?

悬赏问题

  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘