Putting data in a volume in a Dockerfile

1 · Jérôme Petazzoni · Jan. 19, 2015, midnight
In a Dockerfile, if you put data in a directory, and then declare that directory to be a volume, weird things can happen. Let’s see what exactly. The problem Someone contacted me to ask about very slow build times. They told me: “This is weird. In this Dockerfile, the VOLUME and CMD lines take a few minutes. Why is that?” The diagnostic I was very intrigued, and investigated. And I found the reason! The Dockerfile looked roughly like this: FROM someimage RUN mkdir /data ADD http://.../somefile1 ...