My docker-compose.yml
version: '3.1'
services:
redis:
container_name: redis
image: redis:3.0
app_prod:
container_name: app_prod
build:
dockerfile: .docker/app/prod.Dockerfile
context: ./../
ports:
- "8080:80"
links:
- mysql:mysql
- redis:redis
depends_on:
- mysql
- redis
environment:
PRODUCTION_MODE: 'true'
entrypoint: .docker/app/sh/entry-point.sh
mysql:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: 'my-db'
build:
context: ./mysql # path to folder containing Dockerfile
My .docker/app/sh/entry-point.sh
#!/usr/bin/env bash
set -e # exit script if any command fails (non-zero value)
echo Waiting for redis service start...;
while ! nc -z redis 6379;
do
sleep 1;
done;
echo Waiting for mysql service start...;
while ! nc -z mysql 3306;
do
sleep 1;
done;
echo Connected!;
php www/index.php orm:schema-tool:update --force
exec "$@"
I am building by command:
docker-compose -f .docker/docker-compose-prod.yml up -d --build
All containers are built successfully but at the end is running entrypoint script of container app_prod (.docker/app/sh/entry-point.sh). Entry point script was processed successfully too but after execute entrypoint script is app_prod container stopped.
It is some way to keep container running?
Thanks