Now that I found a way to expose host files to the container (-v option) I would like to do kind of the opposite:
How can I edit files from a running container with
The best way is:
$ docker cp CONTAINER:FILEPATH LOCALFILEPATH $ vi LOCALFILEPATH $ docker cp LOCALFILEPATH CONTAINER:FILEPATH
Limitations with $ docker exec: it can only attach to a running container.
Limitations with $ docker run: it will create a new container.