Container closes immediately on Docker-Compose

Asked

Viewed 125 times

0

I set up a portable 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 in the terminal the Exit container, only with the line "command:", when I take that line the container goes up normal.

I need that command line to change permissions in the Storage folder. How can I do ?

1 answer

1


  • Thank you for the answer ! but it didn’t work, in the container log it was returned after I added: chown: cannot access '&&': No such file or directory chown: cannot access 'apache2-foreground': No such file or directory

  • Do you have any idea how I can fix ?

  • he should be there, you can try to add the absolute path (/usr/local/bin/apache2-foreground), or replace the && by a simple ;, so it starts even if the chown fail ...

  • Now he found the path to apache2-foreground, but it didn’t work "&&" nor ";" => chown: cannot access '&&': No such file or directory and => chown: cannot access ';': No such file or directory unfortunately :(

  • command: /bin/sh -c 'chown www-data. /var/blog/storage ; apache2-foreground'

  • It worked! Thank you !!!

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.