I'm trying to create a dockerfile to build a LAMP server for development using the alpine-lamp
base.
FROM glats/alpine-lamp
ENV MYSQL_ROOT_PASSWORD=password
RUN apk add wget && \
apk add php7-simplexml && \
mysql -u root -ppassword -e "CREATE DATABASE IF NOT EXISTS mydb"
When I run the docker image build -t testing .
command to build my image I get an error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
Is my mysql command being run before the "parent" dockerfile has completed running? I've been able to remove these lines and start the container, and then run the identical mysql command from the cli, so I'm thinking the mysql server part of the parent lamp stack just didn't get completely run. Is there a way to ensure my commands run after the parent?