容器不从图像运行
我有一个图像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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
删除
命令:Gunicorn -B 0.0.0.0:8000从您的
wsgi :docker -compose.yaml
中删除否则图像不会启动任何过程
这是官方的Dockerfile文档有关更多信息。
Remove
command: gunicorn -b 0.0.0.0:8000 segmentation_site.wsgi
from yourdocker-compose.yaml
and put it into yourDockerfile
like this:Otherwise the image doesn't start any process
Here is the official Dockerfile documentation for more information.