In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the relevant information shared by Docker container configuration Nginx instance. Friends who need it can refer to it.
As the most popular application at present, Docker does have its uniqueness. Both programmers and operators should have heard of the name Docker. Docker has gone through many pitfalls. The latest version is v1.11.0, which should be said to be fully capable of carrying development and operation and maintenance monitoring. This tool can help us efficiently package, release and run the container system that hosts the application. And collecting logs and helping with the rapid development of App are of great help.
Container and virtual machine, often compared with the two products, in fact, there is a fundamental difference between the two. The virtual machine completely simulates a real computer, and the system running on it may or may not know that it is running in a virtualized environment, and the virtual machine carries the function of converting user instructions into privileged instructions, so the virtual machine is very complex, but very complete, while Docker is completely different. Docker uses the host's own Linux kernel, and then generates disk directories and software from the image. All processes are running on the host. If you are interested, you can ps aux to find the processes running in Docker, but Docker encapsulates it like chroot.
Real usage of Docker
In the early days of the development of Docker, because lightweight images such as busybox were incomplete, reduced and slimmed down images of major distributions were used more frequently, especially because Docker itself was developed in Ubuntu environment, so Ubuntu and Debian were used as base images in many images to generate target images. However, with the use in practice, its disadvantages have also been exposed, that is, it is too heavy-quantified, such as the logging function of systemd and the logging function of Docker itself are repeatedly used, and it is difficult to reduce the image to less than 300m. And the recommended way to use Docker is a single-process model, rather than multiple processes like a complete operating system. Therefore, lightweight base images such as alpine are created, and Baidu can be used for whatever alpine is. This image is officially recommended by Docker. In the future, the official image will be migrated to the alpine-based image. Therefore, we should be familiar with this image as soon as possible.
Build Dockerfile
This article is about the Nginx practice of the Docker container, but there is actually an official alpine image of Nginx. In the process of actual use, the author is more likely to use Tengine, so according to the reference of the official Dockerfile, the author wrote the Dockerfile of Tengine image by himself, hoping to throw a brick to attract jade, and you can criticize and correct it.
FROM alpine:3.3MAINTAINER ChasonTang chasontang@gmail.com ENV TENGINE_VERSION 2.1.2ENV CONFIG "--prefix=/etc/nginx\-- sbin-path=/usr/sbin/nginx\-- conf-path=/etc/nginx/nginx.conf\-- error-log-path=/var/log/nginx/error.log\-- http-log-path=/var/log/nginx/access.log\-pid-path=/var/run/nginx.pid\-- lock-path= / var/run/nginx.lock\-http-client-body-temp-path=/var/cache/nginx/client_temp\-http-proxy-temp-path=/var/cache/nginx/proxy_temp\-http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp\-http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp\-http-scgi-temp-path=/var/cache/nginx/scgi_temp\-user=nginx \-- group=nginx\-- with-http_ssl_module\-- with-http_realip_module\-- with-http_addition_module\-- with-http_sub_module\-- with-http_dav_module\-- with-http_flv_module\-- with-http_mp4_module\-- with-http_gunzip_module\-with-http_gzip_static_module\-- with-http_random_index_module\ -- with-http_secure_link_module\-- with-http_auth_request_module\-- with-mail\-- with-mail_ssl_module\-- with-file-aio\-- with-http_spdy_module\-- with-ipv6\-with-jemalloc\ "ADD ngx_user.patch / ADD repositories / etc/apk/repositoriesRUN\ addgroup-S nginx\ & & adduser-D-S-h / var/cache/nginx-s / Sbin/nologin-G nginx nginx\ & & apk add-- no-cache-- virtual. Build-deps\ gcc\ libc-dev\ make\ openssl-dev\ pcre-dev\ zlib-dev\ linux-headers\ curl\ jemalloc-dev\ & curl "http://tengine.taobao.org/download/tengine- KaTeX parse error: Expected 'EOF' Got'&'at position 45:... Ngine.tar.gz\ & mkdir-p / usr... TENGINE_VERSION/src/os/unix/\ & & mv / ngx_user.patch. / ngx_user.patch\ & & patch ngx_user.c ngx_user.patch\ & & rm ngx_user.patch\ & & cd... /... /... / # & & cd / usr/src/tengine-$TENGINE_VERSION\ & &. / configure $CONFIG-- with-debug\ & make\ & & mv objs/nginx objs/nginx-debug\ & &. / configure KaTeX parse error: Expected 'EOF', got' &'at position 10: CONFIG\ & make\ & & mak … (\ scanelf-- needed-- nobanner / usr/sbin/nginx\ | awk'{gsub (/, /, "\ nso:", $2); print "so:" $2}'\ | sort-u\ | xargs-r apk info-installed\ | sort-u\) "& & apk add-- virtual. Nginx-rundeps KaTeX parse error: Expected 'EOF', got' &'at position 11: runDeps\ & apk del .buil... NGINX_VERSION\ & & apk add-- no-cache gettext\\ # forward request and error logs to docker log collector & & ln-sf / dev/stdout / var/log/nginx/access.log\ & & ln-sf / dev/stderr / var/log/nginx/error.logCOPY nginx.conf / etc/nginx/nginx.confCOPY nginx.vh.default.conf / etc/nginx/conf.d/default.confEXPOSE 80 443CMD ["nginx", "- g", "daemon off;"]
Article source: search engine Daquan http://www.iis7.com/b/ssyqdq/
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.