So, I have the following docker-compose file:
version: "3"
services:
webserver:
build:
context: ./bin/webserver
container_name: 'png-webserver'
restart: 'always'
ports:
- "18011:80"
- "14431:443"
links:
- mysql
volumes:
- ${DOCUMENT_ROOT-./www}:/var/www/html
- ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
- ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
- ${LOG_DIR-./logs/apache2}:/var/log/apache2
mysql:
build: ./bin/mysql
container_name: 'png-mysql'
restart: 'always'
ports:
- "13306:3306"
volumes:
- ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
- ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
- ./mysqlhome:/home
environment:
MYSQL_ROOT_PASSWORD: tiger
MYSQL_DATABASE: nubuilder
MYSQL_USER: deckoff
MYSQL_PASSWORD: deeppurple
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: 'png-phpmyadmin'
links:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: 3306
ports:
- '18080:80'
volumes:
- /sessions
And the following Dockerfile ( for the mariadb container):
FROM mariadb:10.1
RUN mysql --defaults-extra-file='/home/secret' nubuilder4 < /home/nubuilder4.sql
RUN apt-get update && apt-get install -y nano
RUN bash -c 'echo [mysqld] >> /etc/mysql/my.cnf'
RUN bash -c 'echo sql-mode=NO_ENGINE_SUBSTITUTION >> /etc/mysql/my.cnf'
In a nutshell - seems like RUN commands in the Dockerfile never run. I would expected the 2 lined appended to the file, and nano installed, but none of this happens. I have tried running them after starting the containers, and they work fine. Seems like I am doing something wrong.
Also, I have no idea how to debug that.
mysql:block in thedocker-compose.yml? - David Mazedocker-compose build? - jwodder