图片中的容器不是 运行
Container not running from image
我有一张图片 segmentation_site_segmentation_site
。该图像是根据以下 Docker 文件和 Docker-Compose 文件构建的。
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
segmentation_site_segmentation_site latest e1793ab30737 3 hours ago 3.07GB
Docker文件
FROM python:3
ENV PYTHONUNBUFFERED 1
WORKDIR /app
ADD . /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install --upgrade pip
RUN pip3 install -r requirements.txt
COPY . /app
Docker-编写文件
version: '3'
services:
segmentation_site:
build: .
command: gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi
ports:
- 8000:8000
docker-compose up
运行 完美呈现图像,加载的模型显示出来。
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ sudo docker-compose up
Starting segmentation_site_segmentation_site_1 ... done
Attaching to segmentation_site_segmentation_site_1
segmentation_site_1 | [2022-05-10 16:36:26 +0000] [1] [INFO] Starting gunicorn 20.0.4
segmentation_site_1 | [2022-05-10 16:36:26 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
segmentation_site_1 | [2022-05-10 16:36:26 +0000] [1] [INFO] Using worker: sync
segmentation_site_1 | [2022-05-10 16:36:26 +0000] [8] [INFO] Booting worker with pid: 8
segmentation_site_1 | 2022-05-10 16:36:32.195915: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
segmentation_site_1 | 2022-05-10 16:36:32.196645: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
segmentation_site_1 | tensorflow imported.
segmentation_site_1 | 2022-05-10 16:36:46.315257: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
segmentation_site_1 | 2022-05-10 16:36:46.317221: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
segmentation_site_1 | 2022-05-10 16:36:46.318149: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (73c56bba055c): /proc/driver/nvidia/version does not exist
segmentation_site_1 | model loaded.
但是当我运行使用docker run e1793ab30737
将该图像作为容器时,它没有显示输出
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ sudo docker run e1793ab30737
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$
任何人都可以解释一下 运行 图像 docker 运行 命令的正确方法是什么,因为当这个图像将被拉到部署位置时,它只能是 运行 使用 docker run
命令。
谢谢
从您的 docker-compose.yaml
中删除 command: gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi
并将其放入您的 Dockerfile
中,如下所示:
CMD gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi
否则图像不会启动任何进程
我有一张图片 segmentation_site_segmentation_site
。该图像是根据以下 Docker 文件和 Docker-Compose 文件构建的。
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
segmentation_site_segmentation_site latest e1793ab30737 3 hours ago 3.07GB
Docker文件
FROM python:3
ENV PYTHONUNBUFFERED 1
WORKDIR /app
ADD . /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install --upgrade pip
RUN pip3 install -r requirements.txt
COPY . /app
Docker-编写文件
version: '3'
services:
segmentation_site:
build: .
command: gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi
ports:
- 8000:8000
docker-compose up
运行 完美呈现图像,加载的模型显示出来。
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ sudo docker-compose up
Starting segmentation_site_segmentation_site_1 ... done
Attaching to segmentation_site_segmentation_site_1
segmentation_site_1 | [2022-05-10 16:36:26 +0000] [1] [INFO] Starting gunicorn 20.0.4
segmentation_site_1 | [2022-05-10 16:36:26 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
segmentation_site_1 | [2022-05-10 16:36:26 +0000] [1] [INFO] Using worker: sync
segmentation_site_1 | [2022-05-10 16:36:26 +0000] [8] [INFO] Booting worker with pid: 8
segmentation_site_1 | 2022-05-10 16:36:32.195915: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
segmentation_site_1 | 2022-05-10 16:36:32.196645: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
segmentation_site_1 | tensorflow imported.
segmentation_site_1 | 2022-05-10 16:36:46.315257: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
segmentation_site_1 | 2022-05-10 16:36:46.317221: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
segmentation_site_1 | 2022-05-10 16:36:46.318149: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (73c56bba055c): /proc/driver/nvidia/version does not exist
segmentation_site_1 | model loaded.
但是当我运行使用docker run e1793ab30737
将该图像作为容器时,它没有显示输出
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ sudo docker run e1793ab30737
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$
任何人都可以解释一下 运行 图像 docker 运行 命令的正确方法是什么,因为当这个图像将被拉到部署位置时,它只能是 运行 使用 docker run
命令。
谢谢
从您的 docker-compose.yaml
中删除 command: gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi
并将其放入您的 Dockerfile
中,如下所示:
CMD gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi
否则图像不会启动任何进程