mirror of
https://github.com/yeasy/docker_practice.git
synced 2024-12-25 22:48:54 +00:00
Remove dockerfile in appendix #209
This commit is contained in:
parent
31fdca5373
commit
ff460c1f43
@ -15,46 +15,4 @@ bash-4.2#
|
|||||||
|
|
||||||
### Dockerfile
|
### Dockerfile
|
||||||
|
|
||||||
#### CentOS 5 版本
|
请到 https://github.com/docker-library/docs/tree/master/centos 查看。
|
||||||
```
|
|
||||||
FROM scratch
|
|
||||||
MAINTAINER The CentOS Project <cloud-ops@centos.org>
|
|
||||||
ADD c5-docker.tar.xz /
|
|
||||||
LABEL name="CentOS Base Image" \
|
|
||||||
vendor="CentOS" \
|
|
||||||
license="GPLv2" \
|
|
||||||
build-date="2016-03-31"
|
|
||||||
|
|
||||||
# Default command
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### CentOS 6 版本
|
|
||||||
```
|
|
||||||
FROM scratch
|
|
||||||
MAINTAINER https://github.com/CentOS/sig-cloud-instance-images
|
|
||||||
ADD centos-6-docker.tar.xz /
|
|
||||||
|
|
||||||
LABEL name="CentOS Base Image" \
|
|
||||||
vendor="CentOS" \
|
|
||||||
license="GPLv2" \
|
|
||||||
build-date="20160729"
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### CentOS 7 版本
|
|
||||||
```
|
|
||||||
FROM scratch
|
|
||||||
MAINTAINER https://github.com/CentOS/sig-cloud-instance-images
|
|
||||||
ADD centos-7-docker.tar.xz /
|
|
||||||
|
|
||||||
LABEL name="CentOS Base Image" \
|
|
||||||
vendor="CentOS" \
|
|
||||||
license="GPLv2" \
|
|
||||||
build-date="20160729"
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,239 +26,4 @@ $ docker run -it --link some-mongo:mongo --rm mongo sh -c 'exec mongo "$MONGO_PO
|
|||||||
|
|
||||||
### Dockerfile
|
### Dockerfile
|
||||||
|
|
||||||
#### 2.6 版本
|
请到 https://github.com/docker-library/docs/tree/master/mongo 查看。
|
||||||
```
|
|
||||||
FROM debian:wheezy
|
|
||||||
|
|
||||||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
|
||||||
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
ca-certificates wget \
|
|
||||||
numactl \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
|
||||||
ENV GOSU_VERSION 1.7
|
|
||||||
RUN set -x \
|
|
||||||
&& 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
|
|
||||||
|
|
||||||
ENV MONGO_VERSION 2.6.12
|
|
||||||
|
|
||||||
RUN set -x \
|
|
||||||
&& wget -O mongo.tgz "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGO_VERSION.tgz" \
|
|
||||||
&& wget -O mongo.tgz.sig "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGO_VERSION.tgz.sig" \
|
|
||||||
&& export GNUPGHOME="$(mktemp -d)" \
|
|
||||||
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys DFFA3DCF326E302C4787673A01C4E7FAAAB2461C \
|
|
||||||
&& gpg --batch --verify mongo.tgz.sig mongo.tgz \
|
|
||||||
&& rm -r "$GNUPGHOME" mongo.tgz.sig \
|
|
||||||
&& tar -xvf mongo.tgz -C /usr/local --strip-components=1 \
|
|
||||||
&& rm mongo.tgz
|
|
||||||
|
|
||||||
RUN mkdir -p /data/db /data/configdb \
|
|
||||||
&& chown -R mongodb:mongodb /data/db /data/configdb
|
|
||||||
VOLUME /data/db /data/configdb
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 27017
|
|
||||||
CMD ["mongod"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3.0 版本
|
|
||||||
```
|
|
||||||
FROM debian:wheezy
|
|
||||||
|
|
||||||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
|
||||||
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
numactl \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# grab 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
|
|
||||||
|
|
||||||
# gpg: key 7F0CEB10: public key "Richard Kreuter <richard@10gen.com>" imported
|
|
||||||
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 492EAFE8CD016A07919F1D2B9ECBEC467F0CEB10
|
|
||||||
|
|
||||||
ENV MONGO_MAJOR 3.0
|
|
||||||
ENV MONGO_VERSION 3.0.12
|
|
||||||
|
|
||||||
RUN echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/$MONGO_MAJOR main" > /etc/apt/sources.list.d/mongodb-org.list
|
|
||||||
|
|
||||||
RUN set -x \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y \
|
|
||||||
mongodb-org=$MONGO_VERSION \
|
|
||||||
mongodb-org-server=$MONGO_VERSION \
|
|
||||||
mongodb-org-shell=$MONGO_VERSION \
|
|
||||||
mongodb-org-mongos=$MONGO_VERSION \
|
|
||||||
mongodb-org-tools=$MONGO_VERSION \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& rm -rf /var/lib/mongodb \
|
|
||||||
&& mv /etc/mongod.conf /etc/mongod.conf.orig
|
|
||||||
|
|
||||||
RUN mkdir -p /data/db /data/configdb \
|
|
||||||
&& chown -R mongodb:mongodb /data/db /data/configdb
|
|
||||||
VOLUME /data/db /data/configdb
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 27017
|
|
||||||
CMD ["mongod"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3.2 版本
|
|
||||||
|
|
||||||
```
|
|
||||||
FROM debian:wheezy
|
|
||||||
|
|
||||||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
|
||||||
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
numactl \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# grab 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
|
|
||||||
|
|
||||||
# pub 4096R/AAB2461C 2014-02-25 [expires: 2016-02-25]
|
|
||||||
# Key fingerprint = DFFA 3DCF 326E 302C 4787 673A 01C4 E7FA AAB2 461C
|
|
||||||
# uid MongoDB 2.6 Release Signing Key <packaging@mongodb.com>
|
|
||||||
#
|
|
||||||
# pub 4096R/EA312927 2015-10-09 [expires: 2017-10-08]
|
|
||||||
# Key fingerprint = 42F3 E95A 2C4F 0827 9C49 60AD D68F A50F EA31 2927
|
|
||||||
# uid MongoDB 3.2 Release Signing Key <packaging@mongodb.com>
|
|
||||||
#
|
|
||||||
ENV GPG_KEYS \
|
|
||||||
DFFA3DCF326E302C4787673A01C4E7FAAAB2461C \
|
|
||||||
42F3E95A2C4F08279C4960ADD68FA50FEA312927
|
|
||||||
RUN set -ex \
|
|
||||||
&& for key in $GPG_KEYS; do \
|
|
||||||
apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
ENV MONGO_MAJOR 3.2
|
|
||||||
ENV MONGO_VERSION 3.2.8
|
|
||||||
|
|
||||||
RUN echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/$MONGO_MAJOR main" > /etc/apt/sources.list.d/mongodb-org.list
|
|
||||||
|
|
||||||
RUN set -x \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y \
|
|
||||||
mongodb-org=$MONGO_VERSION \
|
|
||||||
mongodb-org-server=$MONGO_VERSION \
|
|
||||||
mongodb-org-shell=$MONGO_VERSION \
|
|
||||||
mongodb-org-mongos=$MONGO_VERSION \
|
|
||||||
mongodb-org-tools=$MONGO_VERSION \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& rm -rf /var/lib/mongodb \
|
|
||||||
&& mv /etc/mongod.conf /etc/mongod.conf.orig
|
|
||||||
|
|
||||||
RUN mkdir -p /data/db /data/configdb \
|
|
||||||
&& chown -R mongodb:mongodb /data/db /data/configdb
|
|
||||||
VOLUME /data/db /data/configdb
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 27017
|
|
||||||
CMD ["mongod"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3.3 版本
|
|
||||||
|
|
||||||
```
|
|
||||||
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 mongodb && useradd -r -g mongodb mongodb
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
numactl \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# grab 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
|
|
||||||
|
|
||||||
# pub 4096R/A15703C6 2016-01-11 [expires: 2018-01-10]
|
|
||||||
# Key fingerprint = 0C49 F373 0359 A145 1858 5931 BC71 1F9B A157 03C6
|
|
||||||
# uid MongoDB 3.4 Release Signing Key <packaging@mongodb.com>
|
|
||||||
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 0C49F3730359A14518585931BC711F9BA15703C6
|
|
||||||
|
|
||||||
ENV MONGO_MAJOR 3.3
|
|
||||||
ENV MONGO_VERSION 3.3.10
|
|
||||||
|
|
||||||
RUN echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/$MONGO_MAJOR main" > /etc/apt/sources.list.d/mongodb-org.list
|
|
||||||
|
|
||||||
RUN set -x \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y \
|
|
||||||
mongodb-org-unstable=$MONGO_VERSION \
|
|
||||||
mongodb-org-unstable-server=$MONGO_VERSION \
|
|
||||||
mongodb-org-unstable-shell=$MONGO_VERSION \
|
|
||||||
mongodb-org-unstable-mongos=$MONGO_VERSION \
|
|
||||||
mongodb-org-unstable-tools=$MONGO_VERSION \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& rm -rf /var/lib/mongodb \
|
|
||||||
&& mv /etc/mongod.conf /etc/mongod.conf.orig
|
|
||||||
|
|
||||||
RUN mkdir -p /data/db /data/configdb \
|
|
||||||
&& chown -R mongodb:mongodb /data/db /data/configdb
|
|
||||||
VOLUME /data/db /data/configdb
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 27017
|
|
||||||
CMD ["mongod"]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
@ -23,104 +23,5 @@ $ docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Dockerfile
|
### Dockerfile
|
||||||
#### 5.6 版本
|
|
||||||
```
|
|
||||||
FROM debian:wheezy
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
|
|
||||||
# File::Basename
|
|
||||||
# File::Copy
|
|
||||||
# Sys::Hostname
|
|
||||||
# Data::Dumper
|
|
||||||
RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
|
|
||||||
RUN apt-get update && apt-get install -y libaio1 && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
|
|
||||||
RUN gpg --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
|
|
||||||
|
|
||||||
ENV MYSQL_MAJOR 5.6
|
|
||||||
ENV MYSQL_VERSION 5.6.20
|
|
||||||
|
|
||||||
# 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-linux-glibc2.5-x86_64.tar.gz" -o mysql.tar.gz \
|
|
||||||
&& curl -SL "http://mysql.he.net/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz.asc" -o mysql.tar.gz.asc \
|
|
||||||
&& apt-get purge -y --auto-remove curl \
|
|
||||||
&& gpg --verify mysql.tar.gz.asc \
|
|
||||||
&& mkdir /usr/local/mysql \
|
|
||||||
&& tar -xzf mysql.tar.gz -C /usr/local/mysql --strip-components=1 \
|
|
||||||
&& rm mysql.tar.gz* \
|
|
||||||
&& rm -rf /usr/local/mysql/mysql-test /usr/local/mysql/sql-bench \
|
|
||||||
&& rm -rf /usr/local/mysql/bin/*-debug /usr/local/mysql/bin/*_embedded \
|
|
||||||
&& find /usr/local/mysql -type f -name "*.a" -delete \
|
|
||||||
&& apt-get update && apt-get install -y binutils && rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& { find /usr/local/mysql -type f -executable -exec strip --strip-all '{}' + || true; } \
|
|
||||||
&& apt-get purge -y --auto-remove binutils
|
|
||||||
ENV PATH $PATH:/usr/local/mysql/bin:/usr/local/mysql/scripts
|
|
||||||
|
|
||||||
WORKDIR /usr/local/mysql
|
|
||||||
VOLUME /var/lib/mysql
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 3306
|
|
||||||
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mysql"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 5.7 版本
|
|
||||||
```
|
|
||||||
FROM debian:wheezy
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
|
|
||||||
# File::Basename
|
|
||||||
# File::Copy
|
|
||||||
# Sys::Hostname
|
|
||||||
# Data::Dumper
|
|
||||||
RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
|
|
||||||
RUN apt-get update && apt-get install -y libaio1 && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
|
|
||||||
RUN gpg --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
|
|
||||||
|
|
||||||
ENV MYSQL_MAJOR 5.7
|
|
||||||
ENV MYSQL_VERSION 5.7.4-m14
|
|
||||||
|
|
||||||
# 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-linux-glibc2.5-x86_64.tar.gz" -o mysql.tar.gz \
|
|
||||||
&& curl -SL "http://mysql.he.net/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz.asc" -o mysql.tar.gz.asc \
|
|
||||||
&& apt-get purge -y --auto-remove curl \
|
|
||||||
&& gpg --verify mysql.tar.gz.asc \
|
|
||||||
&& mkdir /usr/local/mysql \
|
|
||||||
&& tar -xzf mysql.tar.gz -C /usr/local/mysql --strip-components=1 \
|
|
||||||
&& rm mysql.tar.gz* \
|
|
||||||
&& rm -rf /usr/local/mysql/mysql-test /usr/local/mysql/sql-bench \
|
|
||||||
&& rm -rf /usr/local/mysql/bin/*-debug /usr/local/mysql/bin/*_embedded \
|
|
||||||
&& find /usr/local/mysql -type f -name "*.a" -delete \
|
|
||||||
&& apt-get update && apt-get install -y binutils && rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& { find /usr/local/mysql -type f -executable -exec strip --strip-all '{}' + || true; } \
|
|
||||||
&& apt-get purge -y --auto-remove binutils
|
|
||||||
ENV PATH $PATH:/usr/local/mysql/bin:/usr/local/mysql/scripts
|
|
||||||
|
|
||||||
WORKDIR /usr/local/mysql
|
|
||||||
VOLUME /var/lib/mysql
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 3306
|
|
||||||
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mysql"]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
请到 https://github.com/docker-library/docs/tree/master/mysql 查看
|
||||||
|
@ -37,67 +37,5 @@ docker run --name some-nginx -v /some/nginx.conf:/etc/nginx/nginx.conf:ro -d ngi
|
|||||||
使用配置文件时,为了在容器中正常运行,需要保持 `daemon off;`。
|
使用配置文件时,为了在容器中正常运行,需要保持 `daemon off;`。
|
||||||
|
|
||||||
### Dockerfile
|
### Dockerfile
|
||||||
#### stable 版本
|
|
||||||
```
|
|
||||||
FROM debian:jessie
|
|
||||||
|
|
||||||
MAINTAINER NGINX Docker Maintainers "docker-maint@nginx.com"
|
|
||||||
|
|
||||||
ENV NGINX_VERSION 1.10.1-1~jessie
|
|
||||||
|
|
||||||
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
|
|
||||||
&& echo "deb http://nginx.org/packages/debian/ jessie nginx" >> /etc/apt/sources.list \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install --no-install-recommends --no-install-suggests -y \
|
|
||||||
ca-certificates \
|
|
||||||
nginx=${NGINX_VERSION} \
|
|
||||||
nginx-module-xslt \
|
|
||||||
nginx-module-geoip \
|
|
||||||
nginx-module-image-filter \
|
|
||||||
nginx-module-perl \
|
|
||||||
nginx-module-njs \
|
|
||||||
gettext-base \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# forward request and error logs to docker log collector
|
|
||||||
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
|
|
||||||
&& ln -sf /dev/stderr /var/log/nginx/error.log
|
|
||||||
|
|
||||||
EXPOSE 80 443
|
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 1.11.x 版本
|
|
||||||
|
|
||||||
```
|
|
||||||
FROM debian:jessie
|
|
||||||
|
|
||||||
MAINTAINER NGINX Docker Maintainers "docker-maint@nginx.com"
|
|
||||||
|
|
||||||
ENV NGINX_VERSION 1.11.1-1~jessie
|
|
||||||
|
|
||||||
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
|
|
||||||
&& echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install --no-install-recommends --no-install-suggests -y \
|
|
||||||
ca-certificates \
|
|
||||||
nginx=${NGINX_VERSION} \
|
|
||||||
nginx-module-xslt \
|
|
||||||
nginx-module-geoip \
|
|
||||||
nginx-module-image-filter \
|
|
||||||
nginx-module-perl \
|
|
||||||
nginx-module-njs \
|
|
||||||
gettext-base \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# forward request and error logs to docker log collector
|
|
||||||
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
|
|
||||||
&& ln -sf /dev/stderr /var/log/nginx/error.log
|
|
||||||
|
|
||||||
EXPOSE 80 443
|
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
请到 https://github.com/docker-library/docs/tree/master/nginx 查看。
|
||||||
|
@ -28,124 +28,4 @@ $ docker run -it --rm --name my-running-script -v "$(pwd)":/usr/src/myapp -w /us
|
|||||||
|
|
||||||
### Dockerfile
|
### Dockerfile
|
||||||
|
|
||||||
#### 0.10 版本
|
请到 https://github.com/docker-library/docs/tree/master/node 查看。
|
||||||
```
|
|
||||||
FROM buildpack-deps
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
ca-certificates \
|
|
||||||
curl
|
|
||||||
|
|
||||||
# verify gpg and sha256: http://nodejs.org/dist/v0.10.31/SHASUMS256.txt.asc
|
|
||||||
# gpg: aka "Timothy J Fontaine (Work) <tj.fontaine@joyent.com>"
|
|
||||||
RUN gpg --keyserver pgp.mit.edu --recv-keys 7937DFD2AB06298B2293C3187D33FF9D0246406D
|
|
||||||
|
|
||||||
ENV NODE_VERSION 0.10.32
|
|
||||||
|
|
||||||
RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
|
|
||||||
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
|
||||||
&& gpg --verify SHASUMS256.txt.asc \
|
|
||||||
&& grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
|
|
||||||
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
|
|
||||||
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc
|
|
||||||
|
|
||||||
CMD [ "node" ]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 4.x 版本
|
|
||||||
```
|
|
||||||
FROM buildpack-deps:jessie
|
|
||||||
|
|
||||||
# gpg keys listed at https://github.com/nodejs/node
|
|
||||||
RUN set -ex \
|
|
||||||
&& for key in \
|
|
||||||
9554F04D7259F04124DE6B476D5A82AC7E37093B \
|
|
||||||
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
|
|
||||||
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
|
|
||||||
FD3A5288F042B6850C66B31F09FE44734EB7990E \
|
|
||||||
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
|
|
||||||
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
|
|
||||||
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
|
|
||||||
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
|
|
||||||
; do \
|
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
ENV NPM_CONFIG_LOGLEVEL info
|
|
||||||
ENV NODE_VERSION 4.4.7
|
|
||||||
|
|
||||||
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
|
|
||||||
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
|
||||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
|
||||||
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
|
|
||||||
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
|
|
||||||
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
|
|
||||||
|
|
||||||
CMD [ "node" ]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 5.x 版本
|
|
||||||
|
|
||||||
```
|
|
||||||
FROM buildpack-deps:jessie
|
|
||||||
|
|
||||||
# gpg keys listed at https://github.com/nodejs/node
|
|
||||||
RUN set -ex \
|
|
||||||
&& for key in \
|
|
||||||
9554F04D7259F04124DE6B476D5A82AC7E37093B \
|
|
||||||
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
|
|
||||||
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
|
|
||||||
FD3A5288F042B6850C66B31F09FE44734EB7990E \
|
|
||||||
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
|
|
||||||
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
|
|
||||||
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
|
|
||||||
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
|
|
||||||
; do \
|
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
ENV NPM_CONFIG_LOGLEVEL info
|
|
||||||
ENV NODE_VERSION 5.12.0
|
|
||||||
|
|
||||||
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
|
|
||||||
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
|
||||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
|
||||||
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
|
|
||||||
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
|
|
||||||
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
|
|
||||||
|
|
||||||
CMD [ "node" ]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 6.x 版本
|
|
||||||
```
|
|
||||||
FROM buildpack-deps:jessie
|
|
||||||
|
|
||||||
# gpg keys listed at https://github.com/nodejs/node
|
|
||||||
RUN set -ex \
|
|
||||||
&& for key in \
|
|
||||||
9554F04D7259F04124DE6B476D5A82AC7E37093B \
|
|
||||||
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
|
|
||||||
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
|
|
||||||
FD3A5288F042B6850C66B31F09FE44734EB7990E \
|
|
||||||
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
|
|
||||||
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
|
|
||||||
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
|
|
||||||
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
|
|
||||||
; do \
|
|
||||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
ENV NPM_CONFIG_LOGLEVEL info
|
|
||||||
ENV NODE_VERSION 6.3.1
|
|
||||||
|
|
||||||
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
|
|
||||||
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
|
||||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
|
||||||
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
|
|
||||||
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
|
|
||||||
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
|
|
||||||
|
|
||||||
CMD [ "node" ]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
@ -31,113 +31,5 @@ $ docker run -it --link some-redis:redis --rm redis sh -c 'exec redis-cli -h "$R
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Dockerfile
|
### Dockerfile
|
||||||
#### 3.0 版本
|
|
||||||
```
|
|
||||||
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 redis && useradd -r -g redis redis
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
||||||
ca-certificates \
|
|
||||||
wget \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
|
||||||
ENV GOSU_VERSION 1.7
|
|
||||||
RUN set -x \
|
|
||||||
&& 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
|
|
||||||
|
|
||||||
ENV REDIS_VERSION 3.0.7
|
|
||||||
ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-3.0.7.tar.gz
|
|
||||||
ENV REDIS_DOWNLOAD_SHA1 e56b4b7e033ae8dbf311f9191cf6fdf3ae974d1c
|
|
||||||
|
|
||||||
# for redis-sentinel see: http://redis.io/topics/sentinel
|
|
||||||
RUN buildDeps='gcc libc6-dev make' \
|
|
||||||
&& set -x \
|
|
||||||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL" \
|
|
||||||
&& echo "$REDIS_DOWNLOAD_SHA1 *redis.tar.gz" | sha1sum -c - \
|
|
||||||
&& mkdir -p /usr/src/redis \
|
|
||||||
&& tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1 \
|
|
||||||
&& rm redis.tar.gz \
|
|
||||||
&& make -C /usr/src/redis \
|
|
||||||
&& make -C /usr/src/redis install \
|
|
||||||
&& rm -r /usr/src/redis \
|
|
||||||
&& apt-get purge -y --auto-remove $buildDeps
|
|
||||||
|
|
||||||
RUN mkdir /data && chown redis:redis /data
|
|
||||||
VOLUME /data
|
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
|
||||||
RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat
|
|
||||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 6379
|
|
||||||
CMD [ "redis-server" ]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3.2 版本
|
|
||||||
```
|
|
||||||
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 redis && useradd -r -g redis redis
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
||||||
ca-certificates \
|
|
||||||
wget \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
|
||||||
ENV GOSU_VERSION 1.7
|
|
||||||
RUN set -x \
|
|
||||||
&& 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
|
|
||||||
|
|
||||||
ENV REDIS_VERSION 3.2.3
|
|
||||||
ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-3.2.3.tar.gz
|
|
||||||
ENV REDIS_DOWNLOAD_SHA1 92d6d93ef2efc91e595c8bf578bf72baff397507
|
|
||||||
|
|
||||||
# for redis-sentinel see: http://redis.io/topics/sentinel
|
|
||||||
RUN buildDeps='gcc libc6-dev make' \
|
|
||||||
&& set -x \
|
|
||||||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL" \
|
|
||||||
&& echo "$REDIS_DOWNLOAD_SHA1 *redis.tar.gz" | sha1sum -c - \
|
|
||||||
&& mkdir -p /usr/src/redis \
|
|
||||||
&& tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1 \
|
|
||||||
&& rm redis.tar.gz \
|
|
||||||
&& make -C /usr/src/redis \
|
|
||||||
&& make -C /usr/src/redis install \
|
|
||||||
&& rm -r /usr/src/redis \
|
|
||||||
&& apt-get purge -y --auto-remove $buildDeps
|
|
||||||
|
|
||||||
RUN mkdir /data && chown redis:redis /data
|
|
||||||
VOLUME /data
|
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
|
||||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
||||||
|
|
||||||
EXPOSE 6379
|
|
||||||
CMD [ "redis-server" ]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
请到 https://github.com/docker-library/docs/tree/master/redis 查看。
|
||||||
|
@ -15,130 +15,4 @@ root@523c70904d54:/#
|
|||||||
|
|
||||||
### Dockerfile
|
### Dockerfile
|
||||||
|
|
||||||
#### 12.04 版本
|
请到 https://github.com/docker-library/docs/tree/master/ubuntu 查看。
|
||||||
```
|
|
||||||
FROM scratch
|
|
||||||
ADD precise-core-amd64.tar.gz /
|
|
||||||
|
|
||||||
# a few minor docker-specific tweaks
|
|
||||||
# see https://github.com/dotcloud/docker/blob/master/contrib/mkimage/debootstrap
|
|
||||||
RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
|
|
||||||
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \
|
|
||||||
&& chmod +x /usr/sbin/policy-rc.d \
|
|
||||||
\
|
|
||||||
&& dpkg-divert --local --rename --add /sbin/initctl \
|
|
||||||
&& cp -a /usr/sbin/policy-rc.d /sbin/initctl \
|
|
||||||
&& sed -i 's/^exit.*/exit 0/' /sbin/initctl \
|
|
||||||
\
|
|
||||||
&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup \
|
|
||||||
\
|
|
||||||
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
\
|
|
||||||
&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages \
|
|
||||||
\
|
|
||||||
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes
|
|
||||||
|
|
||||||
# delete all the apt list files since they're big and get stale quickly
|
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
|
||||||
# this forces "apt-get update" in dependent images, which is also good
|
|
||||||
|
|
||||||
# enable the universe
|
|
||||||
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
|
|
||||||
|
|
||||||
# upgrade packages for now, since the tarballs aren't updated frequently enough
|
|
||||||
RUN apt-get update && apt-get dist-upgrade -y && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# overwrite this with 'CMD []' in a dependent Dockerfile
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 14.04 版本
|
|
||||||
```
|
|
||||||
FROM scratch
|
|
||||||
ADD trusty-core-amd64.tar.gz /
|
|
||||||
|
|
||||||
# a few minor docker-specific tweaks
|
|
||||||
# see https://github.com/dotcloud/docker/blob/master/contrib/mkimage/debootstrap
|
|
||||||
RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
|
|
||||||
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \
|
|
||||||
&& chmod +x /usr/sbin/policy-rc.d \
|
|
||||||
\
|
|
||||||
&& dpkg-divert --local --rename --add /sbin/initctl \
|
|
||||||
&& cp -a /usr/sbin/policy-rc.d /sbin/initctl \
|
|
||||||
&& sed -i 's/^exit.*/exit 0/' /sbin/initctl \
|
|
||||||
\
|
|
||||||
&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup \
|
|
||||||
\
|
|
||||||
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
\
|
|
||||||
&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages \
|
|
||||||
\
|
|
||||||
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes
|
|
||||||
|
|
||||||
# delete all the apt list files since they're big and get stale quickly
|
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
|
||||||
# this forces "apt-get update" in dependent images, which is also good
|
|
||||||
|
|
||||||
# enable the universe
|
|
||||||
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
|
|
||||||
|
|
||||||
# upgrade packages for now, since the tarballs aren't updated frequently enough
|
|
||||||
RUN apt-get update && apt-get dist-upgrade -y && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# overwrite this with 'CMD []' in a dependent Dockerfile
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 16.04 版本
|
|
||||||
|
|
||||||
```
|
|
||||||
FROM scratch
|
|
||||||
ADD ubuntu-xenial-core-cloudimg-amd64-root.tar.gz /
|
|
||||||
|
|
||||||
# a few minor docker-specific tweaks
|
|
||||||
# see https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap
|
|
||||||
RUN set -xe \
|
|
||||||
\
|
|
||||||
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L40-L48
|
|
||||||
&& echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
|
|
||||||
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \
|
|
||||||
&& chmod +x /usr/sbin/policy-rc.d \
|
|
||||||
\
|
|
||||||
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L54-L56
|
|
||||||
&& dpkg-divert --local --rename --add /sbin/initctl \
|
|
||||||
&& cp -a /usr/sbin/policy-rc.d /sbin/initctl \
|
|
||||||
&& sed -i 's/^exit.*/exit 0/' /sbin/initctl \
|
|
||||||
\
|
|
||||||
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L71-L78
|
|
||||||
&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup \
|
|
||||||
\
|
|
||||||
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L85-L105
|
|
||||||
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
\
|
|
||||||
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L109-L115
|
|
||||||
&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages \
|
|
||||||
\
|
|
||||||
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L118-L130
|
|
||||||
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes \
|
|
||||||
\
|
|
||||||
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L134-L151
|
|
||||||
&& echo 'Apt::AutoRemove::SuggestsImportant "false";' > /etc/apt/apt.conf.d/docker-autoremove-suggests
|
|
||||||
|
|
||||||
# delete all the apt list files since they're big and get stale quickly
|
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
|
||||||
# this forces "apt-get update" in dependent images, which is also good
|
|
||||||
|
|
||||||
# enable the universe
|
|
||||||
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
|
|
||||||
|
|
||||||
# overwrite this with 'CMD []' in a dependent Dockerfile
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,100 +19,5 @@ $ docker run --name some-wordpress --link some-mysql:mysql -d wordpress
|
|||||||
* `-e WORDPRESS_AUTH_KEY=...`, `-e WORDPRESS_SECURE_AUTH_KEY=...`, `-e WORDPRESS_LOGGED_IN_KEY=...`, `-e WORDPRESS_NONCE_KEY=...`, `-e WORDPRESS_AUTH_SALT=...`, `-e WORDPRESS_SECURE_AUTH_SALT=...`, `-e WORDPRESS_LOGGED_IN_SALT=...`, `-e WORDPRESS_NONCE_SALT=...` 缺省为随机 sha1 串
|
* `-e WORDPRESS_AUTH_KEY=...`, `-e WORDPRESS_SECURE_AUTH_KEY=...`, `-e WORDPRESS_LOGGED_IN_KEY=...`, `-e WORDPRESS_NONCE_KEY=...`, `-e WORDPRESS_AUTH_SALT=...`, `-e WORDPRESS_SECURE_AUTH_SALT=...`, `-e WORDPRESS_LOGGED_IN_SALT=...`, `-e WORDPRESS_NONCE_SALT=...` 缺省为随机 sha1 串
|
||||||
|
|
||||||
### Dockerfile
|
### Dockerfile
|
||||||
#### 4.0 版本
|
|
||||||
```
|
|
||||||
FROM debian:wheezy
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
apache2 \
|
|
||||||
curl \
|
|
||||||
libapache2-mod-php5 \
|
|
||||||
php5-curl \
|
|
||||||
php5-gd \
|
|
||||||
php5-mysql \
|
|
||||||
rsync \
|
|
||||||
wget \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
RUN a2enmod rewrite
|
|
||||||
|
|
||||||
# copy a few things from apache's init script that it requires to be setup
|
|
||||||
ENV APACHE_CONFDIR /etc/apache2
|
|
||||||
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
|
|
||||||
# and then a few more from $APACHE_CONFDIR/envvars itself
|
|
||||||
ENV APACHE_RUN_USER www-data
|
|
||||||
ENV APACHE_RUN_GROUP www-data
|
|
||||||
ENV APACHE_RUN_DIR /var/run/apache2
|
|
||||||
ENV APACHE_PID_FILE $APACHE_RUN_DIR/apache2.pid
|
|
||||||
ENV APACHE_LOCK_DIR /var/lock/apache2
|
|
||||||
ENV APACHE_LOG_DIR /var/log/apache2
|
|
||||||
ENV LANG C
|
|
||||||
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR
|
|
||||||
|
|
||||||
# make CustomLog (access log) go to stdout instead of files
|
|
||||||
# and ErrorLog to stderr
|
|
||||||
RUN find "$APACHE_CONFDIR" -type f -exec sed -ri ' \
|
|
||||||
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
|
|
||||||
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
|
|
||||||
' '{}' ';'
|
|
||||||
|
|
||||||
RUN rm -rf /var/www/html && mkdir /var/www/html
|
|
||||||
VOLUME /var/www/html
|
|
||||||
WORKDIR /var/www/html
|
|
||||||
|
|
||||||
ENV WORDPRESS_VERSION 4.0.0
|
|
||||||
ENV WORDPRESS_UPSTREAM_VERSION 4.0
|
|
||||||
|
|
||||||
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
|
|
||||||
RUN curl -SL http://wordpress.org/wordpress-${WORDPRESS_UPSTREAM_VERSION}.tar.gz | tar -xzC /usr/src/
|
|
||||||
|
|
||||||
COPY docker-apache.conf /etc/apache2/sites-available/wordpress
|
|
||||||
RUN a2dissite 000-default && a2ensite wordpress
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
EXPOSE 80
|
|
||||||
CMD ["apache2", "-DFOREGROUND"]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 4.5 版本
|
|
||||||
```
|
|
||||||
FROM php:5.6-apache
|
|
||||||
|
|
||||||
RUN a2enmod rewrite expires
|
|
||||||
|
|
||||||
# install the PHP extensions we need
|
|
||||||
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev && rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
|
|
||||||
&& docker-php-ext-install gd mysqli opcache
|
|
||||||
|
|
||||||
# set recommended PHP.ini settings
|
|
||||||
# see https://secure.php.net/manual/en/opcache.installation.php
|
|
||||||
RUN { \
|
|
||||||
echo 'opcache.memory_consumption=128'; \
|
|
||||||
echo 'opcache.interned_strings_buffer=8'; \
|
|
||||||
echo 'opcache.max_accelerated_files=4000'; \
|
|
||||||
echo 'opcache.revalidate_freq=60'; \
|
|
||||||
echo 'opcache.fast_shutdown=1'; \
|
|
||||||
echo 'opcache.enable_cli=1'; \
|
|
||||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
|
|
||||||
|
|
||||||
VOLUME /var/www/html
|
|
||||||
|
|
||||||
ENV WORDPRESS_VERSION 4.5.3
|
|
||||||
ENV WORDPRESS_SHA1 835b68748dae5a9d31c059313cd0150f03a49269
|
|
||||||
|
|
||||||
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
|
|
||||||
RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \
|
|
||||||
&& echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \
|
|
||||||
&& tar -xzf wordpress.tar.gz -C /usr/src/ \
|
|
||||||
&& rm wordpress.tar.gz \
|
|
||||||
&& chown -R www-data:www-data /usr/src/wordpress
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
|
||||||
|
|
||||||
# grr, ENTRYPOINT resets CMD now
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
CMD ["apache2-foreground"]
|
|
||||||
```
|
|
||||||
|
|
||||||
|
请到 https://github.com/docker-library/docs/tree/master/wordpress 查看。
|
||||||
|
Loading…
Reference in New Issue
Block a user