I've got a very strange issue here, and i am not sure what i am doing wrong, must be something simple but i just cannot figure it out.
My docker-compose.yml:
mysql:
image: mysql:5.7
container_name: mysql
environment:
- MYSQL_ROOT_PASSWORD=aaa
- MYSQL_DATABASE=aaa
- MYSQL_USER=aaa
- MYSQL_PASSWORD=aaa
- MYSQL_PORT=3306
- MYSQL_HOST=localhost
php-fpm:
build: .
dockerfile: php-fpm/Dockerfile
container_name: php-fpm
volumes:
- ../app:/var/www/html
links:
- mysql
environment:
PHP_php5enmod: 'bcmath gd gmp intl mbstring mysql mysqli pcntl pdo_mysql redis zip sockets'
caddy:
build: .
dockerfile: caddy/Dockerfile
container_name: caddy
volumes:
- ../app:/var/www/html
- ./caddy/Caddyfile:/etc/Caddyfile
- ./caddy/certs:/root/.caddy
ports:
- "80:80"
- "443:443"
links:
- mysql
- php-fpm
The Dockerfile for php-fpm:
FROM alterway/php:7.1-fpm
# update
RUN apt-get update && apt-get install -y bash zip unzip
# require the asset plugin
RUN composer global require "fxp/composer-asset-plugin:^1.3.1"
# copy the entrypoint
COPY ./php-fpm/docker-entrypoint.sh /root/docker-entrypoint.sh
# setup permissions
RUN chmod +x /root/docker-entrypoint.sh
# Clean up, try to reduce image size (much as you can on Debian..)
RUN apt-get autoremove -y \
&& apt-get clean all \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/share/doc /usr/share/man /usr/share/locale
ENTRYPOINT ["/root/docker-entrypoint.sh"]
( if i comment out the ENTRYPOINT the container starts just fine )
And in my docker-entrypoint.sh file, i am just trying to run a migration:
#!/bin/bash
# run the migration
/var/www/html/yii migrate/up --interactive=0 --migrationPath=/var/www/html/vendor/twisted1919/yii2-options/migrations
So all i want to do is to run a shell script right after the container starts, but nothing seems to work.
Another thing, if i comment out the ENTRYPOINT in my Dockerfile, while the container starts and executes the database migration, it complaints it does not find a valid mysql driver, but if i login in the container and try to run the migration manually, then it works just fine, so maybe something is wrong with alterway/docker-php