Django在码头工人。看不到日志

时间:2021-01-15 19:21:53

I am trying to pack a django project into docker environment.

我正在尝试将django项目打包到docker环境中。

My docker file looks like

我的docker文件看起来是这样的

FROM python:2.7

EXPOSE 8000

COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt

COPY code /code
WORKDIR /code

ENTRYPOINT ./manage.py runserver 0.0.0.0:8000

requirements.txt

Django==1.10.6

Everything works fine but id don't see any output from django server. If I am attaching to container then I can see its output.

一切正常,但是id没有看到来自django服务器的任何输出。如果我连接到容器,那么我可以看到它的输出。

But when I am trying to call

但当我打电话的时候

docker logs -f "containerid"

码头工人日志- f“containerid”

I receive nothing

我什么也没得到

1 个解决方案

#1


1  

Try starting the container with the -t flag. In other words add the -t flag to the docker run command

尝试使用-t标志启动容器。换句话说,向docker run命令添加-t标志

-t, --tty Allocates a pseudo-TTY

-t, -tty分配了一个伪tty

Update: docker service update -t service_name , note this cmd has to target a manager node.

更新:docker服务更新-t service_name,注意这个cmd必须针对一个管理节点。

When you run docker service create you can include -t flag. The parameters are the same between create and update.

当您运行docker服务时,创建您可以包含-t标志。创建和更新之间的参数是相同的。

#1


1  

Try starting the container with the -t flag. In other words add the -t flag to the docker run command

尝试使用-t标志启动容器。换句话说,向docker run命令添加-t标志

-t, --tty Allocates a pseudo-TTY

-t, -tty分配了一个伪tty

Update: docker service update -t service_name , note this cmd has to target a manager node.

更新:docker服务更新-t service_name,注意这个cmd必须针对一个管理节点。

When you run docker service create you can include -t flag. The parameters are the same between create and update.

当您运行docker服务时,创建您可以包含-t标志。创建和更新之间的参数是相同的。