无法启动 Docker 容器

无法启动 Docker 容器

我使用 flask、nginx 和 uwsgi 构建了一个图像。

FROM ubuntu:14.04
MAINTAINER Ali Mezgani <[email protected]>

RUN apt-get update && apt-get -y install python python-dev  python-pip
RUN apt-get -y install supervisor
RUN apt-get -y install  nginx

COPY ./app /app

RUN mkdir /var/log/uwsgi/

RUN pip install -r ./app/requirements.txt

RUN rm -fr /etc/nginx/conf.d/*
RUN rm -fr /etc/nginx/sites-enabled/*

COPY app.conf /etc/supervisor/conf.d/app.conf

RUN echo "daemon off;" >> /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/sites-enabled/app.conf

expose 80
CMD ["supervisord", "-n"]
CMD ["nginx"]

这是我尝试启动 myapp 容器时得到的输出。

root@cygne:/data/flask# docker start myapp
Error response from daemon: No such container: myapp
Error: failed to start containers: myapp

最后,这是我拥有的图像的状态。

root@cygne:/data/flask# docker images -a
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              91c4b97dc883        10 hours ago        434.1 MB
myapp               latest              3b9dd7cc7006        10 hours ago        434.1 MB
<none>              <none>              28f96039d2da        10 hours ago        434.1 MB
<none>              <none>              dbd7d20bb041        10 hours ago        434.1 MB
<none>              <none>              f29621c65c25        10 hours ago        434.1 MB
<none>              <none>              7d6d99d831c4        10 hours ago        434.1 MB
<none>              <none>              948cc751026f        10 hours ago        434.1 MB
<none>              <none>              afc13c68670c        10 hours ago        434.1 MB
<none>              <none>              90733b74c1ff        10 hours ago        434.1 MB
<none>              <none>              f8252e26afe5        10 hours ago        424.4 MB
<none>              <none>              4b16f8a9bfbb        10 hours ago        424.4 MB
<none>              <none>              126961e5d0b2        10 hours ago        418.6 MB
<none>              <none>              713635425c68        10 hours ago        400.1 MB
<none>              <none>              0755786fa8dc        10 hours ago        396.2 MB
<none>              <none>              3bc29edbc3a3        10 hours ago        188 MB
ubuntu              14.04               8f1bd21bd25c        3 weeks ago         188 MB
mysql               5.7                 2fd136002c22        3 weeks ago         378.4 MB

容器无法启动,我尝试了很多方法,比如清理缓存、重启docker。以下是我的系统日志中的内容:

localhost docker[6111]: time="2016-06-18T15:06:12.826760681Z" level=error msg="Handler for GET /v1.23/containers/myapp/json returned error: No such container: myapp"

答案1

您必须使用docker run从镜像创建容器。请参阅Docker 运行参考关于如何使用它。

docker start是重新启动先前停止的容器。

相关内容