## nginx 以 daemon off 形式启动 /usr/sbin/nginx -g "daemon off;"
Why is it needed daemon off; ?
Imagine a scenario like this:
If there is no daemon off, nginx runs in the background, then nginx is not a pid 1 program, but executes other (such as bash), this bash executes nginx instructions and ends, and the container exits.
Or modify the /etc/nginx/nginx.conf file directly:
echo -e "\ndaemon off;" >> /etc/nginx/nginx.conf
Tomcat
Tomcat was originally developed by Sun’s software architect James Smith. Duncan. Davidson developed, later known as an open source project with his help, and contributed by Sun to the Apache Software Foundation.
Tomcat main function: Run JSP pages and servlets.
.JAVA
Enterprises typically use Sun JDK 6 or Oracle JDK 7+. The Dockerfile is as follows:
## let "Tomcat Native" live somewhere isolated ENV TOMCAT_NATIVE_LIBDIR $CATALINA_HOME/native-jni-lib ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOMCAT_NATIVE_LIBDIR
## runtime dependencies for Tomcat Native Libraries ## Tomcat Native 1.2+ requires a newer version of OpenSSL than debian:jessie has available ## > checking OpenSSL library version >= 1.0.2... ## > configure: error: Your version of OpenSSL is not compatible with this version of tcnative ## see http://tomcat.10.x6.nabble.com/VOTE-Release-Apache-Tomcat-8-0-32-tp5046007p5046024.html (and following discussion) ## and https://github.com/docker-library/tomcat/pull/31
ENV OPENSSL_VERSION 1.0.2g-1ubuntu4.8
## RUN set -ex; \ ## if ! grep -q stretch /etc/apt/sources.list; then \ ## # only add stretch if we're not already building from within stretch ## { \ ## echo 'deb http://deb.debian.org/debian stretch main'; \ ## } > /etc/apt/sources.list.d/stretch.list; \ ## { \ ## # add a negative "Pin-Priority" so that we never ever get packages from stretch unless we explicitly request them ## echo 'Package: *'; \ ## echo 'Pin: release n=stretch'; \ ## echo 'Pin-Priority: -10'; \ ## echo; \ ## # ... except OpenSSL, which is the reason we're here ## echo 'Package: openssl libssl*'; \ ## echo "Pin: version $OPENSSL_VERSION"; \ ## echo 'Pin-Priority: 990'; \ ## } > /etc/apt/preferences.d/stretch-openssl; \ ## fi
## see https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/KEYS ## see also "update.sh" (https://github.com/docker-library/tomcat/blob/master/update.sh)
<?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
<!-- NOTE: By default, no user is included in the "manager-gui" role required to operate the "/manager/html" web application. If you wish to use this app, you must define such a user - the username and password are arbitrary. It is strongly recommended that you do NOT use one of the users in the commented out section below since they are intended for use with the examples web application. -->
<!-- NOTE: The sample user and role entries below are intended for use with the examples web application. They are wrapped in a comment and thus are ignored when reading this file. If you wish to configure these users for use with the examples web application, do not forget to remove the <!.. ..> that surrounds them. You will also need to set the passwords to something appropriate. -->
Middleware serveris a best practice for Docker container apps for the following reasons:
Middleware servers are the main computing nodes in addition to the database server, which can easily become a performance bottleneck, so they usually need to be deployed in large batches, and Docker has many innate advantages for batch deployment
The middleware server structure is clear and stripped downConfiguration filelogCode directory After that, containers can be in a state of almost zero growth, which makes the migration and batch deployment of containers more convenient.
Middleware server clustering is easy to implement after using F5 for hardware, Nginx for software, etc. for software for load balancing
When using middleware containers, You need to plan in advance for resources such as the purpose of the container and the network ports that may be open.
❗ ForProgram codeThe resource directory of the programlogDatabase file and other data that needs to be updated in real time must pass -v Parameters are mapped to the host’s directory, using Docker’s AUFS file format, which can cause big performance problems.