我已经尝试了所有的方法,但无法重启我的docker容器.如果使用--重启 "总是 "它进入无限循环的重启。
下面是Docker文件的配置:----。
FROM continuumio/anaconda3:4.4.0
EXPOSE 8000
RUN echo "deb http://deb.debian.org/debian jessie main" > /etc/apt/sources.list
RUN apt-get update && apt-get install -y apache2 \
apache2-dev \
vim \
&& apt-get clean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/test/
COPY ./test.wsgi /var/www/test/test.wsgi
COPY ./Demo /var/www/test/
RUN /opt/conda/bin/mod_wsgi-express install-module
RUN mod_wsgi-express setup-server test.wsgi --port=8000 \
--user www-data --group www-data \
--server-root=/etc/mod_wsgi-express-80
CMD /etc/mod_wsgi-express-80/apachectl start -D FOREGROUND
并使用下面的命令运行容器:-。
docker run -d -p 8000:8000 --restart always test1
重启后的dockerserver
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4ec5dc90809 test1 "/usr/bin/tini -- /b…" 2 minutes ago Restarting (0) 26 seconds ago practical_colden
我也试过on-failure,但效果不好。
容器的日志
/etc/mod_wsgi-express-80/apachectl: line 63: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
httpd (pid 7) already running
/etc/mod_wsgi-express-80/apachectl: line 63: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
httpd (pid 7) already running
/etc/mod_wsgi-express-80/apachectl: line 63: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
httpd (pid 7) already running
首先想到的是正在运行的命令(不幸的是不完整的)。"/usr/bin/tini -- /b…"
查看源镜像Dockerfile https:/hub.docker.comrcontinuumioanaconda3dockerfile。 那是定义的入口点。您可以更改您最后的 CMD
到一个 ENTRYPOINT
的测试启动docker容器,用 docker run --entrypoint $your-command -p ...
看看是否可行