5 ms·
Reducing Docker Intermediate Layers and Dockerfile Complexity
- yebyen 12y agoI know this is not the solution you are looking for, but here's what I do, when I want a small image after a complex dockerfile and I don't care to distribute it as layers: docker run layered-image -n container /bin/echo #noop docker export container > tarball.tar cat tarball.tar | docker import - flat-image This has the disadvantage that your new flat image doesn't have any CMD directive. You can add it with another dockerfile, starting with FROM flat-image, and skipping straight to CMD ["/bin/bash", "/bootstrap.sh"]