本文主要是介绍tengine-docker镜像制作,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.下载
wget https://tengine.taobao.org/download/tengine-3.0.0.tar.gz
或者直接下载这个包括下边两个配置文件了
https://download.csdn.net/download/cyw8998/89286114
2.编辑nginx.conf文件
#####user nobody;
worker_processes 1;#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#error_log "pipe:rollback logs/error_log interval=1d baknum=7 maxsize=2G";#pid logs/nginx.pid;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;sendfile on;#tcp_nopush on;keepalive_timeout 65;#gzip on;upstream AAA{server 172.16.10.226:50003;server 172.16.10.226:50004;check interval=3000 rise=2 fall=5 timeout=1000 type=http;#check_http_send "HEAD /app/test HTTP/1.0\r\n\r\n";check_http_send "HEAD / HTTP/1.0\r\n\r\n";check_http_expect_alive http_2xx http_3xx;}server {listen 18888;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;#access_log "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G" main;location /status {check_status; #stub_status on;access_log off; }location / {proxy_pass http://AAA;#root html;#index index.html index.htm;}}}
注意check_http_send值的设定。由于它的默认值是"GET / HTTP/1.0\r\n\r\n"。假设你的应用是通过http://ip/name访问的,那么这里你的check_http_send值就需要更改为"GET /name HTTP/1.0\r\n\r\n"才可以。
3.编辑Dockerfile文件
FROM centos:7
#将同级目录下的文件tengine-3.0.0.tar.gz拷贝到该目录下
ADD tengine-3.0.0.tar.gz /usr/local/etc/
## 安装编译工具,开始安装编译tengine
RUN yum install -y gcc gcc-c++ make zlib-devel pcre-devel openssl-devel vim \&& cd /usr/local/etc/tengine-3.0.0 \&& ./configure --add-module=modules/ngx_http_upstream_check_module \&& make \&& make install
# 将Dockerfile同级目录下的nginx.conf配置文件拷贝到镜像的该目录下
ADD nginx.conf /usr/local/nginx/conf/# 向外暴露 80 和 8888 端口
EXPOSE 80 8888 18888# 设置启动命令
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
4.制作镜像
docker build -t tenginetest .
5.运行
docker run -d -p 19999:18888 --name=mytest teginetest
这篇关于tengine-docker镜像制作的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!