首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Mac上运行python-烧瓶容器?

如何在Mac上运行python-烧瓶容器?
EN

Stack Overflow用户
提问于 2017-05-27 11:02:52
回答 1查看 609关注 0票数 0

我学习了一些在线Docker教程,并编写了这个Dockerfile

代码语言:javascript
复制
FROM python:3.5-slim

WORKDIR /opt

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

COPY hello.py /opt/hello.py

EXPOSE 5000

CMD ["python", "/opt/hello.py"]

我用:docker build -t ciasto/pythonflask:v1 .建立了我的形象

其结果是:

代码语言:javascript
复制
$ docker build -t ciasto/pythonflask:v1 .
Sending build context to Docker daemon 4.096 kB
Step 1/7 : FROM python:3.5-slim
3.5-slim: Pulling from library/python
10a267c67f42: Already exists 
f68a39a6a5e4: Pull complete 
fb30faeeb5d1: Pull complete 
b6ab8c11f85f: Pull complete 
69739f677b7a: Pull complete 
Digest: sha256:6cbef17164fc35bed1f43b8cb671c51f5622881008fd748eaf80c20e7bfc0079
Status: Downloaded newer image for python:3.5-slim
 ---> b27a94c44674
Step 2/7 : WORKDIR /opt
 ---> a7724a7ac155
Removing intermediate container 356124f40ff1
Step 3/7 : COPY requirements.txt /opt/requirements.txt
 ---> 9fd790ec548d
Removing intermediate container 8ba92114cd28
Step 4/7 : RUN pip install -r /opt/requirements.txt
 ---> Running in d23ef61ca5fc
Collecting Flask==0.10.1 (from -r /opt/requirements.txt (line 1))
  Downloading Flask-0.10.1.tar.gz (544kB)
Collecting Werkzeug>=0.7 (from Flask==0.10.1->-r /opt/requirements.txt (line 1))
  Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
Collecting Jinja2>=2.4 (from Flask==0.10.1->-r /opt/requirements.txt (line 1))
  Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
Collecting itsdangerous>=0.21 (from Flask==0.10.1->-r /opt/requirements.txt (line 1))
  Downloading itsdangerous-0.24.tar.gz (46kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask==0.10.1->-r /opt/requirements.txt (line 1))
  Downloading MarkupSafe-1.0.tar.gz
Building wheels for collected packages: Flask, itsdangerous, MarkupSafe
  Running setup.py bdist_wheel for Flask: started
  Running setup.py bdist_wheel for Flask: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/b6/09/65/5fcf16f74f334a215447c26769e291c41883862fe0dc7c1430
  Running setup.py bdist_wheel for itsdangerous: started
  Running setup.py bdist_wheel for itsdangerous: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/fc/a8/66/24d655233c757e178d45dea2de22a04c6d92766abfb741129a
  Running setup.py bdist_wheel for MarkupSafe: started
  Running setup.py bdist_wheel for MarkupSafe: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/88/a7/30/e39a54a87bcbe25308fa3ca64e8ddc75d9b3e5afa21ee32d57
Successfully built Flask itsdangerous MarkupSafe
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, itsdangerous, Flask
Successfully installed Flask-0.10.1 Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 itsdangerous-0.24
 ---> 775e776b6838
Removing intermediate container d23ef61ca5fc
Step 5/7 : COPY hello.py /opt/hello.py
 ---> 19591aa43188
Removing intermediate container 72a6ba817af0
Step 6/7 : EXPOSE 5000
 ---> Running in e40c405a1f23
 ---> 3174d4ca3001
Removing intermediate container e40c405a1f23
Step 7/7 : CMD python /opt/hello.py
 ---> Running in 6da3612345ae
 ---> 5504685771d5
Removing intermediate container 6da3612345ae
Successfully built 5504685771d5
macHost:pythonflask$

当我做docker ps -a时,我什么也得不到。我做错什么了?我甚至没有收到任何错误。我用的是Mac OS Sierra。

代码语言:javascript
复制
$ docker -v
Docker version 1.13.1, build 092cba3
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-27 11:17:09

若要查看使用docker构建的所有映像的列表,请运行docker images。它应该显示图像的名称,然后可以使用docker run ciasto/pythonflask:v1运行。

有关docker run命令此链接的更多信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44216049

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档