Question: Lets say I have a container that is fully equipped to serve a Rails app with Passenger and Apache, and I have a vhost that routes to /var/www/app/public in my container. Since a container is supposed to be sort of like a process, what would I do when my Rails code changes? If the `app` was cloned with Git, and there are pending changes in the repo, how can the container `pull` in these changes automatically?

Answer: 
You have a choice on how you want to structure your container, depending on your deployment philosophy:

* **Minimal:** You install all your rails pre-reqs in the Docker file (RUN commands), but have the ENTRYPOINT be something like "`git pull && bundle install --deployment && rails run`". At container boot time it will get your latest code.
* **Snapshot:** Same as above, but have the ENTRYPOINT *also* be a RUN command. This way, the container has a pre-installed snapshot of the code, but it will still update when the container is booted. Sometimes this can speed up boot time (i.e. if most of the gems are already installed).
* **Container as Deployment:** Same as above, but change the ENTRYPOINT to be "`rails run`" only. This way, your container *is* your code. You'll have to make new containers every time you change rails (automation!). The advantage is that your container won't need to contact your code repo at all. The downside is that you have to always remember what the latest container is. (Tags can help) And right now, Docker doesn't have a good story on cleaning up old containers.
In docker v0.8, It will be possible to start a new command in a running container, so you will be able to do what you want.

In the meantime, one solution would consist in using volumes.

Option 1: Docker managed volumes

```
FROM ubuntu
...
VOLUME ["/var/www/app/public"]
ADD host/src/path /var/www/app/public
CMD start rails

```

Start and run your container, then when you need to git pull, you can simply:

```
$ docker ps # -> retrieve the id of the running container
$ docker run -volumes-from <container id> <your image with git installed> sh -c 'cd/var/www/app/public && git pull -u'

```

This will result in your first running container to have the sources updated.

Option 2: Host volumes

You can start your container with: 

```
$ docker run -v `pwd`/srcs:/var/www/app/public <yourimage>

```

and then simply `git pull` in your host's sources directory, it will update the container's sources.