<p>I'm trying to figure out the best way to work with Docker containers in my dev environment, but deploy versioned images of my app to Kubernetes. Here's what I have so far:</p>

<p>I'm using the following Docker image as a base - <a href="https://github.com/shufo/docker-phoenix" rel="nofollow noreferrer">https://github.com/shufo/docker-phoenix</a>. When I create a container for my dev environment (following the instructions) I run:</p>

<pre><code>docker run -d -p 4000:4000 -v $(pwd):/app -w /app shufo/phoenix
</code></pre>

<p>As far as I understand, for Kubernetes, my app needs to be contained in a versioned image. In other words, the code needs to be in the container that's generated, rather than being passed up to the container in a volume?</p>

<p>So I have a Dockerfile that looks like this:</p>

<pre><code>FROM shufo/phoenix

MAINTAINER Hamish Murphy &lt;hamishmurphy@gmail.com&gt;

COPY . /app

WORKDIR /app
</code></pre>

<p>After building the image (with a version number), I can use this to create a Deployment in Kubernetes.</p>

<p>So this is a home baked solution. Is there a common pattern for this?</p>

<p>In my opinion you are on the right track. Including the code in the image is probably considered best practice. I have recently written an <a href="https://stackoverflow.com/questions/43626583/how-to-mount-volume-into-the-source-code-of-the-app/43627520#43627520">answer to another question</a> describing some of the benefits.</p>

<p>In practice people are using all kinds of ways to serve the application to a container. It is possible to use attached volumes or have a Git in the container pull/update the code when deployed but I believe you would need some good reason (that I can't think of) for that being preferable.</p>
