简体   繁体   English

如何从 python 图像运行 docker 容器?

[英]how to run docker container from python image?

I pulled a python image from hub images doing docker pull python:3.9-alpine .我从执行docker pull python:3.9-alpine的中心图像中提取了一个 python 图像。

Then i tried to launch the container from this image doing like docker run -p 8888:8888 --name test_container d4d6be1b90ec .然后我尝试从这个图像启动容器,就像docker run -p 8888:8888 --name test_container d4d6be1b90ec The container is never up.容器永远不会启动。 with docker ps i didn't find it. docker ps 我没找到。

Do you know why please?请问你知道为什么吗?

Thank you,谢谢你,

Your container is not launched because there is no server(nginx,apache etc..) to point, there is only python and the necessary dependencies.您的容器未启动,因为没有服务器(nginx、apache 等)指向,只有 python 和必要的依赖项。

In order to run that image you can try the following command:为了运行该图像,您可以尝试以下命令:

docker run --name test_python -it [id_image] docker 运行 --name test_python -it [id_image]

And if you open another terminal and use docker ps you will see that the container is up.如果你打开另一个终端并使用docker ps你会看到容器已经启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 python 运行 docker 容器 - Run a docker container from python 如何从Docker容器中使用奇点运行python程序? - How to run a python program using Singularity from a docker container? 如何在依赖于另一个镜像的 Docker 镜像或容器中运行多个 Python 脚本? - How to run multiple Python scripts in a Docker image or container that depends on another image? 如何在Docker的容器上运行Python服务器 - How to run Python server on Docker's container 如何在 expressjs Docker 容器中运行 Python - How to run Python inside an expressjs Docker container 如何使用特定 GPU 运行 docker 容器 Docker SDK for Python - How to run a docker container with specific GPUs using Docker SDK for Python 如何从在Docker容器中运行的python脚本(使用docker sdk)创建映像? - How to create an image from an python script (using docker sdk) running in docker container? 如何在python中从docker容器获取文件 - How get file from docker container in python 如何从docker容器内的java / spring-boot项目运行python脚本(并接收输出)? - How to run python script (and receive output) from java/spring-boot project which is inside a docker container? 如何从另一个 Docker 容器连接 Postgres Docker 镜像 - How to connect a Postgres Docker image from another Docker container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM