【发布时间】:2019-07-04 04:00:21
【问题描述】:
我使用以下 Dockerfile 构建了一个 docker 映像:
FROM continuumio/miniconda3
ENTRYPOINT [ “/bin/bash”, “-c” ]
ADD angular_restplus.yaml angular_restplus.yaml
RUN ["conda", "env", "create", "-f", "angular_restplus.yaml"]
RUN ["/bin/bash", "-c", "source activate work"]
COPY json_to_db.py json_to_db.py
CMD ["gunicorn", "-b", "0.0.0.0:3000", "json_to_db:app"]
以及构建它的命令:
sudo docker build -t testimage:latest .
贯穿始终:
Step 5/7 : RUN ["/bin/bash", "-c", "source activate work"]
---> Running in 45c6492b1c67
Removing intermediate container 45c6492b1c67
---> 5b5604dc281d
Step 6/7 : COPY json_to_db.py json_to_db.py
---> e5d05858bed1
Step 7/7 : CMD ["gunicorn", "-b", "0.0.0.0:3000", "json_to_db:app"]
---> Running in 3ada6fd24d09
Removing intermediate container 3ada6fd24d09
---> 6ed934acb671
Successfully built 6ed934acb671
Successfully tagged testimage:latest
但是,当我现在尝试使用它时,它不起作用;我试过了:
sudo docker run --name testimage -d -p 8000:3000 --rm testimage:latest
打印出来效果不错
b963bdf97b01541ec93e1eb7
但是,我无法在浏览器中访问该服务并使用
sudo docker ps -a
仅显示从上方创建图像所需的中间容器。
当我尝试在没有 -d 标志的情况下运行它时,我得到了
gunicorn: 1: [: “/bin/bash”,: unexpected operator
这是否意味着我必须再次更改ENTRYPOINT?如果有,是什么?
【问题讨论】:
-
评论不用于扩展讨论;这个对话是moved to chat。
标签: docker anaconda dockerfile