容器不从图像运行

发布于 2025-01-28 03:54:04 字数 2930 浏览 1 评论 0原文

我有一个图像segengeation_site_sementation_site。该图像是根据以下Dockerfile和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

dockerfile

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-compose文件

version: '3'
services:
    segmentation_site:
        build: .
        command: gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi 
        ports:
            - 8000:8000

进行docker-compose在显示模型时,完美地运行了图像。

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运行E1793AB30737显示该图像作为容器时,它显示没有

junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ sudo docker run e1793ab30737
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ 

任何人可以解释什么是运行Image Docker Run命令的正确方法,只能使用Docker Run命令运行。

谢谢

I have an image segmentation_site_segmentation_site. The image is built from the following Dockerfile and Docker-Compose file.

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

Dockerfile

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-compose file

version: '3'
services:
    segmentation_site:
        build: .
        command: gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi 
        ports:
            - 8000:8000

Doing docker-compose up runs the image perfectly, as the model loaded shows 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.

But when I am running this image as container using docker run e1793ab30737 it shows no output

junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ sudo docker run e1793ab30737
junaidali@ubuntu:~/Documents/segmentation/segmentation_site$ 

Can anyone explain what is the right way to run the image docker run command as when this image will be pulled in the deployment location, it can only be run using docker run command.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

滥情哥ㄟ 2025-02-04 03:54:04

删除命令:Gunicorn -B 0.0.0.0:8000从您的docker -compose.yaml中删除 wsgi :

CMD gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi

否则图像不会启动任何过程

这是官方的Dockerfile文档有关更多信息。

Remove command: gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi from your docker-compose.yaml and put it into your Dockerfile like this:

CMD gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi

Otherwise the image doesn't start any process

Here is the official Dockerfile documentation for more information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文