Container closes immediately on docker-compose

0

I set up a larvel project, created a docker-compose below:

# v3 syntax
version: 3
services:
  # PHP (apache)
  blog:
    image: php:7.1-apache
    container_name: blog-apache
    ports:
      - "8000:80"
    volumes:
      - .:/var/www/blog
      - ./apache/000-default.conf:/etc/apache2/sites-enabled/000-default.conf
    command: "chown www-data:www-data /var/www/blog/storage:

But when I run docker-compose up -d on the terminal the exit container, only with the line "command:", when I throw this line the container goes up normal.

I need this command line to change the permissions on the storage folder. How can I do it?

    
asked by anonymous 13.10.2018 / 18:57

1 answer

1

Yes this is the expected behavior, because you are overwriting the original command of this image, and the container closes as soon as your command is executed.

Change your command to the following:

command: chown www-data:www-data /var/www/blog/storage && apache2-foreground

Original command of this image: link

    
13.10.2018 / 20:51