docker - 我在运行docker-compose up命令时无法收到错误消息

标签 docker docker-compose

当我键入docker-compose run web的命令时
我完全想要的错误消息出现
但是当我键入docker-compose up的命令时
没有错误消息,只有Watching for file changes with StatReloader这样的消息docker-compose logs web也一样。没有错误信息。
如何知道原因?如何调试呢?

我有一个最小的复制库
https://github.com/RayKimEX/mydocker-compose
我真的很想知道这个原因,请帮帮我。请

编辑
当我键入docker-compose run web时,错误消息是NameError: name 'FabricViewSet' is not defined
当docker-compose up

% docker-compose up                                                                                                                                                ✹ ✭
Creating network "zeus_v1_default" with the default driver
Pulling db (postgres:)...
latest: Pulling from library/postgres
b8f262c62ec6: Already exists
fe6da876d968: Pull complete
46b9d53972f5: Pull complete
23a11bddcc75: Pull complete
d6744ba78bdc: Pull complete
8d95423a7aa9: Pull complete
8590ba4183e5: Pull complete
ed97b9b8e039: Pull complete
7b311f33f382: Pull complete
76802d77aa81: Pull complete
d84ab156d91d: Pull complete
3e7bd63c53e6: Pull complete
66992dbe6d8f: Pull complete
cb2fe0741e74: Pull complete
Digest: sha256:1c2e0ae6fa018d8547413423200f4e518ddcb1514e8ce67701993dc7f4dd98bf
Status: Downloaded newer image for postgres:latest
Building web
Step 1/5 : FROM python:3.7
3.7: Pulling from library/python
4a56a430b2ba: Already exists
4b5cacb629f5: Already exists
14408c8d4f9a: Already exists
ea67eaa7dd42: Already exists
4d134ac3fe4b: Already exists
4c55f6f5d7f0: Already exists
6ae475e50652: Already exists
6f4152644229: Already exists
6933d3d46042: Already exists
Digest: sha256:0f0e991a97426db345ca7ec59fa911c8ed27ced27c88ae9966b452bcc6438c2f
Status: Downloaded newer image for python:3.7
 ---> 02d2bb146b3b
Step 2/5 : RUN mkdir /zeus_test
 ---> Running in 355c46808600
Removing intermediate container 355c46808600
 ---> fa61066bd003
Step 3/5 : WORKDIR /zeus_test
 ---> Running in c17c0c9ee031
Removing intermediate container c17c0c9ee031
 ---> 9b6f6d199de6
Step 4/5 : COPY . /zeus_test
 ---> d5fcf394620c
Step 5/5 : RUN pip install -r requirements/docker.txt
 ---> Running in d8d435967de1
Collecting Django<3.0,>=2.0 (from -r requirements/docker.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/b2/79/df0ffea7bf1e02c073c2633702c90f4384645c40a1dd09a308e02ef0c817/Django-2.2.6-py3-none-any.whl (7.5MB)
Collecting psycopg2<3.0,>=2.7 (from -r requirements/docker.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz (377kB)
Collecting djangorestframework==3.10.3 (from -r requirements/docker.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/33/8e/87a4e0025e3c4736c1dc728905b1b06a94968ce08de15304417acb40e374/djangorestframework-3.10.3-py3-none-any.whl (909kB)
Collecting sqlparse (from Django<3.0,>=2.0->-r requirements/docker.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/ef/53/900f7d2a54557c6a37886585a91336520e5539e3ae2423ff1102daf4f3a7/sqlparse-0.3.0-py2.py3-none-any.whl
Collecting pytz (from Django<3.0,>=2.0->-r requirements/docker.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB)
Building wheels for collected packages: psycopg2
  Building wheel for psycopg2 (setup.py): started
  Building wheel for psycopg2 (setup.py): finished with status 'done'
  Created wheel for psycopg2: filename=psycopg2-2.8.3-cp37-cp37m-linux_x86_64.whl size=465814 sha256=a764d67833ce40d10c04da79fa528d47672620caa3da43036dab1ea9f3c51bac
  Stored in directory: /root/.cache/pip/wheels/48/06/67/475967017d99b988421b87bf7ee5fad0dad789dc349561786b
Successfully built psycopg2
Installing collected packages: sqlparse, pytz, Django, psycopg2, djangorestframework
Successfully installed Django-2.2.6 djangorestframework-3.10.3 psycopg2-2.8.3 pytz-2019.3 sqlparse-0.3.0
Removing intermediate container d8d435967de1
 ---> ef23bfb143a0
Successfully built ef23bfb143a0
Successfully tagged zeus_v1_web:latest
WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating zeus_v1_db_1 ... done
Creating zeus_v1_web_1 ... done
Attaching to zeus_v1_db_1, zeus_v1_web_1
db_1   | The files belonging to this database system will be owned by user "postgres".
db_1   | This user must also own the server process.
db_1   |
db_1   | The database cluster will be initialized with locale "en_US.utf8".
db_1   | The default database encoding has accordingly been set to "UTF8".
db_1   | The default text search configuration will be set to "english".
db_1   |
db_1   | Data page checksums are disabled.
db_1   |
db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1   | creating subdirectories ... ok
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | selecting default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting default time zone ... Etc/UTC
db_1   | creating configuration files ... ok
db_1   | running bootstrap script ... ok
db_1   | performing post-bootstrap initialization ... ok
db_1   | syncing data to disk ... ok
db_1   |
db_1   | initdb: warning: enabling "trust" authentication for local connections
db_1   | You can change this by editing pg_hba.conf or using the option -A, or
db_1   | --auth-local and --auth-host, the next time you run initdb.
db_1   |
db_1   | Success. You can now start the database server using:
db_1   |
db_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1   |
db_1   | ****************************************************
db_1   | WARNING: No password has been set for the database.
db_1   |          This will allow anyone with access to the
db_1   |          Postgres port to access your database. In
db_1   |          Docker's default configuration, this is
db_1   |          effectively any other container on the same
db_1   |          system.
db_1   |
db_1   |          Use "-e POSTGRES_PASSWORD=password" to set
db_1   |          it in "docker run".
db_1   | ****************************************************
db_1   | waiting for server to start....2019-10-08 06:51:29.262 UTC [44] LOG:  starting PostgreSQL 12.0 (Debian 12.0-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1   | 2019-10-08 06:51:29.265 UTC [44] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2019-10-08 06:51:29.278 UTC [45] LOG:  database system was shut down at 2019-10-08 06:51:28 UTC
db_1   | 2019-10-08 06:51:29.283 UTC [44] LOG:  database system is ready to accept connections
db_1   |  done
db_1   | server started
db_1   |
db_1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db_1   |
db_1   | waiting for server to shut down...2019-10-08 06:51:29.350 UTC [44] LOG:  received fast shutdown request
db_1   | .2019-10-08 06:51:29.354 UTC [44] LOG:  aborting any active transactions
db_1   | 2019-10-08 06:51:29.362 UTC [44] LOG:  background worker "logical replication launcher" (PID 51) exited with exit code 1
db_1   | 2019-10-08 06:51:29.363 UTC [46] LOG:  shutting down
db_1   | 2019-10-08 06:51:29.379 UTC [44] LOG:  database system is shut down
db_1   |  done
db_1   | server stopped
db_1   |
db_1   | PostgreSQL init process complete; ready for start up.
db_1   |
db_1   | 2019-10-08 06:51:29.475 UTC [1] LOG:  starting PostgreSQL 12.0 (Debian 12.0-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1   | 2019-10-08 06:51:29.476 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2019-10-08 06:51:29.476 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2019-10-08 06:51:29.480 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2019-10-08 06:51:29.500 UTC [53] LOG:  database system was shut down at 2019-10-08 06:51:29 UTC
db_1   | 2019-10-08 06:51:29.508 UTC [1] LOG:  database system is ready to accept connections
web_1  | Watching for file changes with StatReloader

最佳答案

我不知道为什么

但是在tty: trueweb中添加services之后,docker-compose.yml

当我键入docker-compose up的命令时

现在可以在终端中正确打印错误日志

有谁能解释这个???

关于docker - 我在运行docker-compose up命令时无法收到错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58281066/

相关文章:

python - 列出同一 docker-compose 中的容器

java - Wasabi自动重启docker容器

docker - 在 docker swarm 中的特定节点上运行 docker 容器

docker - 如何在docker compose中创建docker卷

pipe - docker-compose 在命令中使用管道

docker - 如何在docker文件中转义#

node.js - docker + Node : node_modules not the same between docker-compose up and docker-compose run

docker - Docker Hello World失败

docker - 为什么我的docker login命令不尊重我传入的服务器参数?

mysql - 使用 Ansible 拉取并运行 mysql-server docker run