Allow manual port mapping when using "run" command. Fixes #1709

Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
This commit is contained in:
Karol Duleba 2015-08-07 13:42:37 +01:00
commit ff87ceabbd
6 changed files with 87 additions and 2 deletions

View file

@ -22,6 +22,7 @@ Options:
-u, --user="" Run as specified username or uid
--no-deps Don't start linked services.
--rm Remove container after run. Ignored in detached mode.
-p, --publish=[] Publish a container's port(s) to the host
--service-ports Run command with the service's ports enabled and mapped to the host.
-T Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.
```
@ -38,6 +39,10 @@ The second difference is the `docker-compose run` command does not create any of
$ docker-compose run --service-ports web python manage.py shell
Alternatively manual port mapping can be specified. Same as when running Docker's `run` command - using `--publish` or `-p` options:
$ docker-compose run --publish 8080:80 -p 2022:22 -p 127.0.0.1:2021:21 web python manage.py shell
If you start a service configured with links, the `run` command first checks to see if the linked service is running and starts the service if it is stopped. Once all the linked services are running, the `run` executes the command you passed it. So, for example, you could run:
$ docker-compose run db psql -h db -U docker