Merge pull request #1824 from mrfuxi/run-with-ports
Allow manual port mapping when using "run" command
This commit is contained in:
commit
b87c09b9fc
6 changed files with 87 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue