So this is my Dockerfile:
FROM alpine
RUN apk add --update --upgrade --no-cache mysql mysql-client
RUN rm -rf /etc/my.cnf /etc/mysql/* /etc/mysql.d/ && \
mkdir -p /var/lib/mysql /var/run/mysqld && \
chown -R mysql /var/lib/mysql /run/mysqld && \
chgrp -R mysql /var/lib/mysql /run/mysqld && \
mysql_install_db --user=mysql --ldata=/var
EXPOSE 3306
USER mysql
CMD ["sh", "mysqld_safe --data=/var"]
My issue is that when I run the container with the image it does not find mysqld_safe
.
But when I run the command manually like this: docker run mysql mysqld_safe --data=/var
it works !
I try to change the dockerfile with:
CMD ["sh", "cat -"]
to see if the problem is with the mysqld_safe
command but same issue here, it does not find cat
except when I run it with docker run mysql cat -
.
Is the problem come from busybox
on alpine, or from PATH ? I have no idea for now and I require you help.