docker-compose phpdocker.io symfony-无法创建缓存目录(/ application / var / cache / dev)

时间:2018-07-14 16:07:52

标签: docker symfony4

我明白了 无法创建缓存目录(/ application / var / cache / dev)

我在docker-compose exec php-fpm bash中运行chown -R 33:33 var 不变

这是我的docker-compose.yml

###############################################################################
#                          Generated on phpdocker.io                          #
###############################################################################
version: "3.1"
services:

    mysql:
      image: mysql:5.7
      container_name: bralionVista-mysql
      working_dir: /application
      volumes:
        - .:/application
      environment:
        - MYSQL_ROOT_PASSWORD=123
        - MYSQL_DATABASE=bralionvista
        - MYSQL_USER=bralionvista
        - MYSQL_PASSWORD=123
      ports:
        - "8087:3306"

    webserver:
      image: nginx:alpine
      container_name: bralionVista-webserver
      working_dir: /application
      volumes:
          - .:/application
          - ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
      ports:
       - "8086:80"

    php-fpm:
      build: phpdocker/php-fpm
      container_name: bralionVista-php-fpm
      working_dir: /application
      volumes:
        - .:/application
        - ~/.ssh/:/root/.ssh/
        - ~/.bash_history:/root/.bash_history
        - ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini


    elastic-search:
      image: willdurand/elk
      container_name: bralionVista-elastic
      ports:
          - 81:80
      volumes:
          - ./elk/logstash:/etc/logstash
          - ./elk/logstash/patterns:/opt/logstash/patterns

更新1

这是我的php-fpm / Dockerfile

FROM phpdockerio/php72-fpm:latest
WORKDIR "/application"

# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive

# Install selected extensions and other stuff
RUN apt-get update \
    && apt-get -y --no-install-recommends install  php7.2-mysql php7.2-tidy php7.2-xmlrpc \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Install git
RUN apt-get update \
    && apt-get -y install git \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

#I add this
ADD entrypoint.sh /entrypoint

ENTRYPOINT ["/entrypoint"]

和内容phpdocker / php-fpm / entrypoint.sh

#!/bin/bash
#from https://github.com/protacon/labs-slack-integration/blob/master/docker-entrypoint.sh
set -e

# If we're starting web-server we need to do following:
#   1) Set correct rights on /application/var -folder
#   2) Clear cache
#   3) Warmup cache

HTTPDUSER=`cat /etc/passwd | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\: -f1`

php /application/bin/console cache:clear --no-warmup
php /application/bin/console cache:clear --env prod --no-warmup
php /application/bin/console cache:warmup
php /application/bin/console cache:warmup --env prod

exec "$@"

获取错误:

docker-compose up
Removing bralionVista-php-fpm
Recreating 0bc112eb578a_0bc112eb578a_bralionVista-php-fpm ... 
bralionVista-elastic is up-to-date
bralionVista-webserver is up-to-date
Recreating 0bc112eb578a_0bc112eb578a_bralionVista-php-fpm
Recreating 0bc112eb578a_0bc112eb578a_bralionVista-php-fpm ... error

ERROR: for 0bc112eb578a_0bc112eb578a_bralionVista-php-fpm  Cannot start service php-fpm: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/entrypoint\": permission denied": unknown

ERROR: for php-fpm  Cannot start service php-fpm: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/entrypoint\": permission denied": unknown
ERROR: Encountered errors while bringing up the project.

0 个答案:

没有答案