Skip to content

Instantly share code, notes, and snippets.

@Wei1234c
Last active September 4, 2015 02:03
Show Gist options
  • Save Wei1234c/dcc952e7d7ab4621cf00 to your computer and use it in GitHub Desktop.
Save Wei1234c/dcc952e7d7ab4621cf00 to your computer and use it in GitHub Desktop.
MySQL dockerfile
# MySQL Dockerfile
# https://github.com/dockerfile/mysql
#
# origin: https://raw.githubusercontent.com/dockerfile/mysql/master/Dockerfile
# modified by: Wei Lin
# date: 2015/9/3
# Pull base image.
FROM armv7/armhf-ubuntu:14.04
MAINTAINER Wei Lin
ENV TERM linux
# Install MySQL.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server-5.6 && \
sed -i 's/^\(bind-address\s.*\)/# \1/' /etc/mysql/my.cnf && \
sed -i 's/^\(log_error\s.*\)/# \1/' /etc/mysql/my.cnf && \
echo "mysqld_safe &" > /tmp/config && \
echo "mysqladmin --silent --wait=30 ping || exit 1" >> /tmp/config && \
echo "mysql -e 'GRANT ALL PRIVILEGES ON *.* TO \"root\"@\"%\" WITH GRANT OPTION;'" >> /tmp/config && \
bash /tmp/config && \
rm -f /tmp/config
# Upgrade and clean up
RUN apt-get dist-upgrade -y && \
apt-get autoremove -y && \
apt-get autoclean -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
# Environment variables
RUN echo " " >> /etc/bash.bashrc && \
echo "#_____________________" >> /etc/bash.bashrc && \
echo "force_color_prompt=yes" >> /etc/bash.bashrc && \
echo "alias cls='clear'" >> /etc/bash.bashrc && \
echo "export TERM=linux" >> /etc/bash.bashrc
# Define mountable directories.
VOLUME ["/etc/mysql", "/var/lib/mysql"]
# Define working directory.
WORKDIR /data
# Expose ports.
EXPOSE 3306
# Define default command.
CMD ["mysqld_safe"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment