 <p>If I understand your question correctly, then maybe try something like this:</p> <p>First create a "dummy" config file in a directory that you will map as a volume</p> <pre><code>mkdir mapdir touch mapdir/myconfig.cfg </code></pre> <p>In your <code>Dockerfile</code> you'll do what you need to do with that config file. Maybe as part of a <code>CMD</code> clause</p> <pre><code>FROM ... RUN ... CMD ["sed", "&lt;editstuff&gt;, "mapdir/myconfig.cfg" ] </code></pre> <p>Then build and run your container</p> <pre><code>docker build . docker run --name mycontainer -v mapdir:mapdir ... </code></pre> <p>It's still a strange approach, but if you absolute can only change the config file from <em>within</em> your container, give this a go.</p>