There are many questions on this site abut it but none of them give me a solution.
from php:7.2-apache copy php.ini "$PHP_INI_DIR/php.ini" copy symfony/ /var/www/html/ run chmod -R o+w /var/www/html/var/cache /var/www/html/var/logs /var/www/html/var/sessions run docker-php-ext-install pdo_mysql opcache copy exec.php /var/www/html/
my docker-compose.yml file:
version: '3' services: web: build: . ports: - "8082:80" depends_on: - mysql command: ["php", "/var/www/html/exec.php"] #command: ["echo", "hello"] mysql: image: "mysql:5" environment: MYSQL_ROOT_PASSWORD: my-secret-pw
The problem comes from the
command key. When I comment the commands the
web runs. from
docker ps I can see the container. But when I add a
web container died on
php-apache_web_1 exited with code 0 and it is not shown from
docker ps while the
mysql container exists and I can interact with it.
From that answer someone says the container exit because the command is completed his task and exited. But I don’t want my server to exit or die/kill. How to prevent the command from returning an exit status without running the command forever?
If you’re curious about why I am running a command, my command do almost exactly how explained there.
What I want is a solution on how to keep my php apache server running and create a database in the mysql server once the php apache image has built.