Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dokcer运行成功后访问页面报错502(前面的issues无法解决) #128

Open
SecLoop opened this issue Aug 25, 2022 · 3 comments
Open

Comments

@SecLoop
Copy link

SecLoop commented Aug 25, 2022

docker version

Client:
 Cloud integration: v1.0.28
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:04:45 2022
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.11.1 (84025)
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:23 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker Compose 版本

Docker Compose version v2.7.0

启动命令

cp -p .env.docker .env
docker-compose up -d

错误

image

docker log 日志

wait-for-it.sh: waiting for mysql:3306 without a timeout
wait-for-it.sh: mysql:3306 is available after 1 seconds
Operations to perform:
  Apply all migrations: admin, auth, authtoken, contenttypes, monitor, sessions
Running migrations:
  No migrations to apply.
Create administrator for admin
/usr/lib/python2.7/dist-packages/supervisor/options.py:298: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2022-08-25 16:28:37,571 CRIT Supervisor running as root (no user in config file)
2022-08-25 16:28:37,571 INFO Included extra file "/home/docker/Github-Monitor/docker/supervisor-app.conf" during parsing
2022-08-25 16:28:37,580 INFO RPC interface 'supervisor' initialized
2022-08-25 16:28:37,580 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2022-08-25 16:28:37,580 INFO supervisord started with pid 20
2022-08-25 16:28:38,582 INFO spawned: 'app-uwsgi' with pid 23
2022-08-25 16:28:38,583 INFO spawned: 'github-task' with pid 24
2022-08-25 16:28:38,585 INFO spawned: 'nginx-app' with pid 25
2022-08-25 16:28:38,586 INFO spawned: 'redis-server' with pid 26
2022-08-25 16:28:38,590 INFO exited: app-uwsgi (exit status 1; not expected)
2022-08-25 16:28:39,599 INFO spawned: 'app-uwsgi' with pid 40
2022-08-25 16:28:39,600 INFO success: github-task entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-08-25 16:28:39,600 INFO success: nginx-app entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-08-25 16:28:39,600 INFO success: redis-server entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-08-25 16:28:39,606 INFO exited: app-uwsgi (exit status 1; not expected)
2022-08-25 16:28:41,610 INFO spawned: 'app-uwsgi' with pid 41
2022-08-25 16:28:41,619 INFO exited: app-uwsgi (exit status 1; not expected)
2022-08-25 16:28:44,623 INFO spawned: 'app-uwsgi' with pid 42
2022-08-25 16:28:44,630 INFO exited: app-uwsgi (exit status 1; not expected)
2022-08-25 16:28:45,631 INFO gave up: app-uwsgi entered FATAL state, too many start retries too quickly

image

@SecLoop
Copy link
Author

SecLoop commented Aug 25, 2022

@lipengfei0539
Copy link

解决了吗?

@JrDw0
Copy link

JrDw0 commented Sep 5, 2024

这个问题似乎是 uwsgi 的问题。

root@050bd111d388:/home/docker/Github-Monitor# /usr/local/bin/uwsgi --ini /home/docker/Github-Monitor/docker/uwsgi.ini
[uWSGI] getting INI configuration from /home/docker/Github-Monitor/docker/uwsgi.ini
*** Starting uWSGI 2.0.17.1 (64bit) on [Thu Sep  5 06:35:35 2024] ***
compiled with version: 7.5.0 on 29 August 2024 02:34:02
os: Linux-6.6.26-linuxkit #1 SMP Sat Apr 27 04:13:19 UTC 2024
nodename: 050bd111d388
machine: aarch64
clock source: unix
detected number of CPU cores: 12
current working directory: /home/docker/Github-Monitor
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /home/docker/Github-Monitor/server/
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
error removing unix socket, unlink(): Operation not supported [core/socket.c line 198]
bind(): Operation not supported [core/socket.c line 230]

我用临时方案解决了,弃用了 uwsgi,直接 runserver 启动了 django
docker 文件夹下的nginx-app.conf

   location /api/ {
        uwsgi_pass  django;
        include     /home/docker/Github-Monitor/docker/uwsgi_params;
    }

改为

    location /api/ {
        proxy_pass http://127.0.0.1:8000;
    }

supervisor-app.conf的

[program:app-uwsgi]
command = /usr/local/bin/uwsgi --ini /home/docker/Github-Monitor/docker/uwsgi.ini

改为

[program:app-uwsgi]
directory = /home/docker/Github-Monitor/server/
command = python3 manage.py runserver

先这样解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants