dotcloud/docker — pull request #1459 by mhennings (2013-08-08 18:27:55+00:00)
Title: Add an option to set the working directory

Add Working directory option
--

This makes it possible to simply wrap a command inside a container without changing the directory. The purpose is to make it easier to use a container as an unified build environment.

Examples:

At ~/workspace/docker
```bash
$ docker run -v `pwd`:`pwd` -w `pwd` -i -t ubuntu ls
AUTHORS	Makefile	archive.go	changes.go	docker
[...]
```
The line above executed "ls" within the current working directory. But the ls was executed within the docker container.

the -v param maps the volumes, while the new -w param sets the working directory before executing the command.

```bash
docker run -v `pwd`:`pwd` -w `pwd` -i -t ubuntu pwd
/home/marco/workspace/docker
```

The line above executed "pwd" within the current working directory. But the ls was executed within the docker container.

If this change is welcome i would be interested in creating a alias like "docker wrap" to make the commandline easier to use.