最初我在 ubuntu Trusty
中安装了 docker 1.5通过 Vagrant 。
然后我创建了新的Ubuntu Trusty
现在 docker 版本是 1.7
.
我尝试使用这个 Dockerfile 构建我的 Postgres 容器的图像
FROM ubuntu:trusty
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
RUN apt-get -y update
RUN apt-get -y install wget openssh-server
RUN apt-get install -y supervisor
RUN mkdir -p /var/run/sshd
RUN wget --quiet --no-check-certificate -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list
RUN apt-get -y update
RUN apt-get -y upgrade
RUN locale-gen --no-purge en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8
RUN apt-get -y install postgresql-9.3 postgresql-contrib-9.3 postgresql-9.3-postgis-2.1 postgis
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
RUN service postgresql start && /bin/su postgres -c "createuser -d -s -r -l docker" && /bin/su postgres -c "psql postgres -c \"ALTER USER docker WITH PASSWORD 'docker'\"" && service postgresql stop
RUN echo "listen_addresses = '*'" >> /etc/postgresql/9.3/main/postgresql.conf
RUN echo "port = 5432" >> /etc/postgresql/9.3/main/postgresql.conf
EXPOSE 5432 22
ADD start.sh /start.sh
RUN chmod 0755 /start.sh
cmd ["supervisord", "-n"]
现在,当我使用 docker 1.5 检查我的 ubuntu 时
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 40G 2.3G 36G 6% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
当我检查 docker 1.7 时
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 40G 14G 24G 38% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
我在服务器上只使用了一张图片进行了专门测试,没有其他任何东西。
我什至检查了磁盘使用情况及其来自
/var/lib/docker/vfs/dir
我想知道 1.7 中发生了什么变化导致了这个
最佳答案
这是一个已知问题
提取自
https://forums.docker.com/t/docker-1-7-0-is-using-huge-amount-of-disk-space/2046/2
“原因似乎在安装脚本 https://get.docker.com/ubuntu/ 上缺少 aufs 设置”
解决方法是
“使用 https://get.docker.com 脚本安装 docker 时工作正常。”
关于ubuntu - Docker 1.7 比 Docker 1.5 消耗更多的图像空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31130812/