Skip to content

No write permission in var/cache #2

@kolesar

Description

@kolesar

Hi,

I do not know if is ti issue with Symfony, Vagrant or Docker, but maybe you can help me with issue what I have.

I created one Vagrant file:

Vagrant.configure(2) do |config|
  config.vm.box = "centos/7"
  config.vm.provider "virtualbox" do |vb|
    vb.memory = 2048
    vb.cpus = 2
  end

  config.vm.synced_folder  '.', "/xsg/"

  config.vm.provision :docker
  config.vm.provision :docker_compose,
    compose_version: "1.19.0",
    yml: "/vagrant/docker-compose.yml",
    run: "always"

  config.vm.provision "shell", path: "./script.sh", run: "always"

  config.vm.network :forwarded_port, guest: 80, host: 9080
  config.vm.network :forwarded_port, guest: 443, host: 9443
  config.vm.network :forwarded_port, guest: 3306, host: 9306
  config.vm.network :forwarded_port, guest: 22, host: 9022, id: 'ssh'
  config.vm.network "private_network", ip: "192.168.10.101"

  config.vm.hostname = "xsg-vagrant-machine"
  config.vm.define "xsg-vagrant-machine"
end

and docker-compose.yaml file:

version: "3.2"
services:

  mysql:
    image: mysql:8.0
    container_name: kolesar-mysql
    working_dir: /var/www/html
    volumes:
      - /xsg/web:/var/www/html
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_DATABASE=kolesar
      - MYSQL_USER=cg_user
      - MYSQL_PASSWORD=cg_password
    networks:
      - frontend
      - backend
    ports:
      - 3306:3306
    command: --default-authentication-plugin=mysql_native_password
    restart: always

  webserver:
    image: miveo/centos-httpd-for-phpfpm
    container_name: kolesar-webserver
    volumes:
      # volume with project specific configuration (eg: vhost)
      - ./webserver/httpd.conf:/etc/httpd/conf/httpd.conf
      # mount your project's source
      - /xsg/web:/var/www/html
    networks:
      - frontend
      - backend
    ports:
      - 80:80
      - 443:443
    # links:
    #   - mysql
        # if your php container have a different host/port than default value, eg:
        # environment:
        #     - PHP_HOST=php_fpm
        #     - PHP_PORT=9001

  php:
    image: miveo/centos-php-fpm:7.2
    container_name: kolesar-php-fpm
    tty: true
    volumes:
      - /xsg/web:/var/www/html
    networks:
      - backend
    # volumes:
    #     # volume with project specific php.ini configuration
    #   - ./php/99-test-project.ini:/etc/php.d/99-test-project.ini

networks:
  frontend:
    internal: false
  backend:
    internal: true

Everything is fine with services. I can access on localhost on port 9080 and so on, but Symfony cannot write into var dir. Whatever I do I get some error from Symfony about write permission, like:

Failed to write file "/var/www/html/var/cache/dev/srcDevDebugProjectContainer.xml".

Do you have any idea what I can do with this? I tried to make my Dockerfile and so on, but the same issue. I guess it is something with Centos and Docker, but I do not know what exactly. I need CentOs, not Ubuntu as many users use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions