ubuntu - Docker 1.7 比 Docker 1.5 消耗更多的图像空间

标签 ubuntu docker vagrant dockerfile

最初我在 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/

相关文章:

Docker 容器以状态码 255 退出

linux - 如何实用地通过代理路由 watir?

python - 标准_init_linux.go :207: exec user process caused "exec format error"

python - 在 OS X 10.10 下的 PyCharm 中使用 VirtualBox 设置 Vagrant 时出错

chef-infra - Chef 加载新 rpm 和安装包的正确方法

linux - K8s 'calico' pod 未启动 : "Failed to create default IPv4 IP pool: 10.244.0.0/16 error=resource does not exist:"

ubuntu - 无法在 Nginx 服务器上访问 phpMyAdmin

docker - 无法在Docker容器中运行FreeBSD终端

mysql - 如何将mysql日志重定向到容器内的/dev/stdout?

virtual-machine - 如何打包不是使用 vagrant up 命令创建的现有虚拟机?