【发布时间】:2020-04-22 06:26:30
【问题描述】:
我正在学习 Docker,并且一直在为 Ubuntu 容器制作 Dockerfile。
我的问题是我不断获取不同容器之间的持久信息。我已经退出,移除了容器,然后移除了它的图像。在对 Dockerfile 进行更改后,我执行了docker build -t playbuntu . 执行以下 Dockerfile:
FROM ubuntu:latest
## for apt to be noninteractive
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
## preesed tzdata, update package index, upgrade packages and install needed software
RUN echo "tzdata tzdata/Areas select Europe" > /tmp/preseed.txt; \
echo "tzdata tzdata/Zones/Europe select London" >> /tmp/preseed.txt; \
debconf-set-selections /tmp/preseed.txt && \
apt-get update && \
apt-get install -y tzdata
RUN apt-get update -y && apt-get upgrade -y && apt-get install tree nano vim -y && apt-get install less -y && apt-get install lamp-server^ -y
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
EXPOSE 80
WORKDIR /var/www
COPY ./index.php /var/www
COPY ./000-default.conf /etc/apache2/sites-available
CMD [ "apache2ctl", "start", "&&", "apache2ctl", "restart" ]
一旦我执行winpty docker run -it -p 80:80 playbuntu bash,我的问题是,而不是我的 index.php 文件输出以下内容:
<?php
print "<center><h3>Sisko's LAMP activated!</h3><center>";
phpinfo();
我得到了几个小时前我尝试过的以下调试代码:
<?php
print "...responding";
phpinfo();
Docker 可能会使用缓存系统吗?我修剪了所有 Docker 卷,以防 Docker 可能会这样缓存。除了 2 个卷被与我的项目无关的其他容器使用之外的所有卷。
【问题讨论】:
标签: docker dockerfile lamp