(1)不同内核版本下载的docker 配置不一致
提示:standard_init_linux.go:220: exec user process caused "exec format error"
下面这个链接有描述
首先:docker pull nginx
docker run -d --name nginx-test --net host -it nginx
curl localhost:80
看能不能启动
然后打自己的docker-> build-> run (--net host )
然后查看
提示:默认文件为default.conf 修改我们文件包nginx.conf 改为default.conf
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
然后查看默认 /etc/nginx/nginx.conf 权限 和当前用户权限比较 就是下面的了
qemu-user-static:利用x86机器编译支持arm架构的docker镜像_1024小神的博客-CSDN博客
(2)nginx.conf 指定权限问题 user root; 不设置就为当前用户权限 比如test
(3)问题 root /usr/share/nginx/html;是nginx默认目录
如果没加上一行代码 也是默认添加这一行
location / {
如果在里面改成新建目录:如下
RUN mkdir -p /home/testconfig/dist/
#COPY dist /usr/share/nginx/html/
COPY dist /home/testconfig/dist/
如果有 root /usr/share/nginx/html; 然后设置这一行 ok 没有的话就不会从根目录开始
alias /home/tools/dist/;
}
docker run -d --name nginx-test --net host -it nginx
curl localhost:80
netstat -apnult| grep 9013 查看 这个端口的调用情况
cat 文件
docker ps
chmod -R 777 ./ -R 为./ 子目录添加权限
ls -l 查看文件权限
uname -r 查看 服务器内核
docker exec -it d-base-tools /bin/bash 进入容器里面看
使用docker内端口设置为服务器访问端口
docker run --name d-base-tools -it -v /home/jialing.wu/nlp_expansion/nlp_expansion_front/config.js:/home/tools/dist/config.js --net host -d base-tools
Dockerfile
COPR nginx.conf /etc/nginx/ 覆盖原来的默认的nginx.conf文件 将权限root
1
2
3
4
5
6
7
8
9
10
11
12FROM nginx USER root MAINTAINER luan RUN mkdir -p /home/tools/dist/ #COPY dist /usr/share/nginx/html/ COPY nginx.conf /etc/nginx/ COPY dist /usr/share/nginx/html/ COPY default.conf /etc/nginx/conf.d/ RUN mkdir -p /opt/nginx/logs/tools.msxf.lo/ RUN echo 'echo init ok!!'
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37user root; worker_processes auto; error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; }
default.conf
使用推荐docker版本的nginx.conf的配置 ,使用docker内端口设置为服务器访问端口
docker run --name d-base-tools -it -v /home/jialing.wu/nlp_expansion/nlp_expansion_front/config.js:/home/tools/dist/config.js --net host -d base-tools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76server { listen 9104; listen [::]:9104; server_name localhost; #access_log /var/log/nginx/host.access.log main; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers X-Requested-With; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; location / { root /usr/share/nginx/html; index index.html index.htm; if ($request_filename ~* config.(js)$) { add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; } } location ^/(.*).(js|css|jpg|png|jpeg|svg|woff|ico|tff)$ { alias /home/tools/dist/; expires 30d; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} }
zkj数字警察备注:
一、部署包安装
交付部署包为docker压缩包:dialogue-police.tar,部署包需要部署在有docker环境的服务器上,docker建议版本:19.03.12。
启动命令:
服务器端口运维设置:9088
容器端口:9013
Docker名称: d-dialogue-police
镜像名称:dialogue-police
容器导入:docker load –i dialogue-police.tar
之前:docker run --name d-dialogue-police -p 9088:9013 -d dialogue-police 2022.12.18: docker run -it -v /home/dialogue_police/dist/config.js:/usr/share/nginx/html/config.js -p 9088:9013 -d dialogue-police
xxx:imagesid
ssss:镜像仓库
dialogue-police:镜像
v2.1:tag
docker build -t i-robot .docker tag xxx ssss/dialogue-police:v2.1
docker rmi harbor.maip.io/ai/dialogue-police:v2.1docker load -i dialogue-police.tar
docker run --name d-dialogue-police -p 9088:9013 -d harbor.maip.io/dialogue-police:v2.1.1
最后
以上就是含蓄水杯最近收集整理的关于常看:华为服务器问题记录docker nginx的全部内容,更多相关常看:华为服务器问题记录docker内容请搜索靠谱客的其他文章。
发表评论 取消回复