Docker Community Forums

Share and learn in the Docker community.

Docker increase size of image when build the same folder?


(Cpfarher) #1

Hello, I have a very strange problem with a “dummy docker test” and driving me crazy…

This is the situation: I have a folder: testdocker with following content (only a .deb file and a Dockerfile):

➜ testdocker ls
Brackets.1.4.Extract.64-bit.deb 
Dockerfile
  • In the Dockerfile I have the following:
FROM busybox
ADD .  /home/
  • I run in a bash console:
docker build -t buxy:base .
  • Then I change the Dockerfile to:
FROM buxy:base
ADD. /home/
  • and run again in a bash console:
docker build -t docker buxy:1 .

Notice that I only change de Dockerfile (.deb file is exactly the same from the start), so I hope that image buxy:1 and buxy:base have the same size, however buxy:1 double the size of buxy:base. It’s like(.deb file added again as if he had changed, but It never changed…

  • Docker images command show:
buxy:1              948f4711864d            10 minutes ago        72.76 MB
buxy:base        09f74a0ef2ed             11 minutes ago        36.94 MB
busybox:latest  2c5ac3f849df              2 days ago              1.113 MB

Look at the first line (it adds 35.83 MB) (I don’t change nothing in the directory, only the Dockerfile line)

➜  testdocker  docker history 948f4711864d
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
948f4711864d        24 minutes ago      /bin/sh -c #(nop) ADD dir:e49857bbba8b11c9088   35.83 MB            
09f74a0ef2ed        25 minutes ago      /bin/sh -c #(nop) ADD dir:295a59eea6b1d0bf692   35.83 MB            
2c5ac3f849df        2 days ago          /bin/sh -c #(nop) CMD ["sh"]                    0 B                 
ab2b8a86ca6c        2 days ago          /bin/sh -c #(nop) ADD file:566aa8660b389e4f82   1.113 MB            

Also I do a full clean of docker and reinstall all without success…

I am using Ubuntu 14.04.3 LTS with kernel 3.13.0-65-generic #106-Ubuntu and Docker version 1.8.3, build f4bf5c7

Thank you!