title: Docker max depth exceeded
body: <p>I getting an error when trying to commit docker container to image:</p>
  
  <pre><code>[root@dockerregistry /]# docker commit da4180ab1536 dockerregistry:5000/myimage
  Error response from daemon: max depth exceeded
  </code></pre>
  
  <p>It does have a lot of layers of previous commits: </p>
  
  <pre><code>[root@dockerregistry /]# docker history dockerregistry:5000/myimage
  IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
  b0922c490bf2        30 hours ago        su - jenkins -c cd /home/jenkins/sources/ ; f   161.7 kB
  91f441d37f9b        2 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   75.05 kB
  ac9669a5bd76        2 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   63.68 kB
  080c3d024017        2 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   120.3 kB
  08a505cc4654        2 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   102.8 kB
  b9babd91b9e2        3 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   237 kB
  4822b25109da        4 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   594.1 kB
  5a2511c28162        5 days ago          bash                                            96.84 MB
  &lt;missing&gt;           5 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   341.3 kB
  &lt;missing&gt;           5 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   1.037 MB
  &lt;missing&gt;           6 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   230.9 kB
  &lt;missing&gt;           7 days ago          su - jenkins -c cd /home/jenkins/sources/ ; f   394 kB
  .....
  .....
  .....
  &lt;missing&gt;           3 months ago        bash                                            98.68 MB
  &lt;missing&gt;           3 months ago        bash                                            417.3 MB
  &lt;missing&gt;           3 months ago        /bin/sh -c #(nop) CMD ["/bin/bash"]             0 B
  &lt;missing&gt;           3 months ago        /bin/sh -c sed -i 's/^#\s*\(deb.*universe\)$/   1.895 kB
  &lt;missing&gt;           3 months ago        /bin/sh -c rm -rf /var/lib/apt/lists/*          0 B
  &lt;missing&gt;           3 months ago        /bin/sh -c set -xe   &amp;&amp; echo '#!/bin/sh' &gt; /u   745 B
  &lt;missing&gt;           3 months ago        /bin/sh -c #(nop) ADD file:fdbd881d78f9d7d924   124.8 MB
  [root@dockerregistry /]# docker history dockerregistry:5000/myimage | wc -l
  130
  </code></pre>
  
  <p>I know there's a limitation of 125 layers, but maybe there's a workaround to glue/merge all layers or to commit as a new image without layers of history?</p>