-
Notifications
You must be signed in to change notification settings - Fork 96
/
Dockerfile
33 lines (27 loc) · 839 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# MySQL Dockerfile
#
# https://github.com/dockerfile/mysql
#
# Pull base image.
FROM dockerfile/ubuntu
# Install MySQL.
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server && \
rm -rf /var/lib/apt/lists/* && \
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
# Define mountable directories.
VOLUME ["/etc/mysql", "/var/lib/mysql"]
# Define working directory.
WORKDIR /data
# Define default command.
CMD ["mysqld_safe"]
# Expose ports.
EXPOSE 3306