配置y总docker

配置y总docker

问题

1.新容器在运行

uwsgi --ini scripts/uwsgi.ini

时可以成功,但源网址(https://app220.acapp.acwing.com.cn/)无法访问

log信息

*** Starting uWSGI 2.0.20 (64bit) on [Thu Dec 30 07:23:11 2021] ***                                                                         [25/56]
compiled with version: 9.3.0 on 28 October 2021 05:02:51                                                                                           
os: Linux-5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021                                                                             
nodename: 2708dab4e09c                                                                                                                             
machine: x86_64                                                                                                                                    
clock source: unix                                                                                                                                 
detected number of CPU cores: 1                                                                                                                    current working directory: /home/doctao/acapp                                                                                                      
detected binary path: /usr/local/bin/uwsgi                                                                                                         !!! no internal routing support, rebuild with pcre support !!!                                                                                     
chdir() to /home/doctao/acapp                                                                                                                      your memory page size is 4096 bytes                                                                                                                
detected max file descriptor number: 1024                                                                                                          lock engine: pthread robust mutexes                                                                                                                
thunder lock: disabled (you can enable it with --thunder-lock)                                                                                     
uwsgi socket 0 bound to TCP address 127.0.0.1:8000 fd 3                                                                                            
Python version: 3.8.10 (default, Sep 28 2021, 16:10:42)  [GCC 9.3.0]                                                                               
Python main interpreter initialized at 0x56304561aa90                                                                                              
python threads support enabled                                                                                                                     
your server socket listen backlog is limited to 100 connections                                                                                    
your mercy for graceful operations on workers is 60 seconds                                                                                        
mapped 344232 bytes (336 KB) for 10 cores                                                                                                    
*** Operational MODE: preforking+threaded ***                                                                                                      
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x56304561aa90 pid: 63 (default app)                                                  
*** uWSGI is running in multiple interpreter mode ***                                                                                              
spawned uWSGI master process (pid: 63)                                                                                                             
spawned uWSGI worker 1 (pid: 65, cores: 5)                                                                                                         
spawned uWSGI worker 2 (pid: 66, cores: 5)                                                                                                         
^CSIGINT/SIGTERM received...killing workers..

尝试运行

python3 manage.py 0.0.0.0:8000

请求到了静态资源却只能加载背景图片

docker不删除容器改端口号的方法

  1. 停止docker服务

    systemctl stop docker
    
  2. 编辑/var/lib/docker/containers/容器id/hostconfig.json,在里面就能修改端口映射

  3. 启动docker服务

    systemctl start docker
    
  4. 启动docker容器

    docker start `docker ps -aq`
    

发现原因

折腾了一上午,终于发现了原因

结论

容器的8000和22端口可以随意映射,80和443端口只能映射到你服务器的80和443端口

最终的docker-compose.yml

version: '3.8'
services:
  acgame:
    container_name: acgame
    image: django_lesson:2.0
    working_dir: /home/doctao/acapp
    tty: true
    ports:
      - "20000:22"
      - "8000:8000"
      - "80:80"
      - "443:443"
      - "8001:5015"
    command: >
      bash -c "sudo redis-server /etc/redis/redis.conf
      && sudo /etc/init.d/nginx start
      && uwsgi --ini scripts/uwsgi.ini
      && daphne -b 0.0.0.0 -p 5015 acapp.asgi:application"


inx start
&& uwsgi --ini scripts/uwsgi.ini
&& daphne -b 0.0.0.0 -p 5015 acapp.asgi:application"


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值