常看:华为服务器问题记录docker nginx

(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

FROM  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


user  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

server {
    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.1

docker load -i dialogue-police.tar

docker run --name d-dialogue-police -p 9088:9013 -d  harbor.maip.io/dialogue-police:v2.1.1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值