Docker + MySQL: returned a non-zero code: 2
I'm trying to build a Dockerfile for MySQL, but for some reason I keep receiving this error code 2. I can build it manually on an identical server, so I am out of good ideas what is going wrong, and hope someone here can help me sort it out?
Also I would like to hear feedback on my entrypoint approach (tail -f /dev/stdout
)
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Copenhagen
RUN apt-get update && apt-get -yq upgrade \
&& apt-get install -yq mysql-server \
&& mysql_secure_installation --use-default --password=123456 \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& ln -sf /dev/stdout /var/log/mysqld.err \
&& { \
echo "[mysqld]"; \
echo "bind-address=0.0.0.0"; \
} > /etc/mysql/conf.d/bind_0.0.0.0.cnf \
&& { \
echo "#!/usr/bin/env bash"; \
echo "set -e"; \
echo "rm -f /run/mysqld/mysqld.pid"; \
echo "/usr/bin/mysqld_safe"; \
echo "tail -f /dev/stdout"; \
} > /usr/local/bin/entrypoint \
&& chmod a+rx /usr/local/bin/entrypoint \
&& apt-get -yq clean autoclean && apt-get -yq autoremove \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 3306/tcp
ENTRYPOINT ["entrypoint"]