forked from docker-library/mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request docker-library#161 from infosiftr/any-user
Allow arbitrary --user values
- Loading branch information
Showing
6 changed files
with
100 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,20 @@ FROM debian:jessie | |
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added | ||
RUN groupadd -r mysql && useradd -r -g mysql mysql | ||
|
||
# add gosu for easy step-down from root | ||
ENV GOSU_VERSION 1.7 | ||
RUN set -x \ | ||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ | ||
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ | ||
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ | ||
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ | ||
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ | ||
&& chmod +x /usr/local/bin/gosu \ | ||
&& gosu nobody true \ | ||
&& apt-get purge -y --auto-remove ca-certificates wget | ||
|
||
RUN mkdir /docker-entrypoint-initdb.d | ||
|
||
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: | ||
|
@@ -19,10 +33,10 @@ ENV MYSQL_MAJOR 5.5 | |
ENV MYSQL_VERSION 5.5.49 | ||
|
||
# note: we're pulling the *.asc file from mysql.he.net instead of dev.mysql.com because the official mirror 404s that file for whatever reason - maybe it's at a different path? | ||
RUN apt-get update && apt-get install -y curl --no-install-recommends && rm -rf /var/lib/apt/lists/* \ | ||
&& curl -SL "http://dev.mysql.com/get/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux2.6-x86_64.tar.gz" -o mysql.tar.gz \ | ||
&& curl -SL "http://mysql.he.net/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux2.6-x86_64.tar.gz.asc" -o mysql.tar.gz.asc \ | ||
&& apt-get purge -y --auto-remove curl \ | ||
RUN apt-get update && apt-get install -y wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ | ||
&& wget "http://dev.mysql.com/get/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux2.6-x86_64.tar.gz" -O mysql.tar.gz \ | ||
&& wget "http://mysql.he.net/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux2.6-x86_64.tar.gz.asc" -O mysql.tar.gz.asc \ | ||
&& apt-get purge -y --auto-remove wget \ | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
# gpg: key 5072E1F5: public key "MySQL Release Engineering <[email protected]>" imported | ||
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 \ | ||
|
@@ -46,11 +60,15 @@ RUN mkdir -p /etc/mysql/conf.d \ | |
echo '[mysqld]'; \ | ||
echo 'skip-host-cache'; \ | ||
echo 'skip-name-resolve'; \ | ||
echo 'user = mysql'; \ | ||
echo 'datadir = /var/lib/mysql'; \ | ||
echo '!includedir /etc/mysql/conf.d/'; \ | ||
} > /etc/mysql/my.cnf | ||
|
||
RUN mkdir -p /var/lib/mysql /var/run/mysqld \ | ||
&& chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ | ||
# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime | ||
&& chmod 777 /var/run/mysqld | ||
|
||
VOLUME /var/lib/mysql | ||
|
||
COPY docker-entrypoint.sh /usr/local/bin/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters