Add --service-ports note to ports section (#12658)

* Add --service-ports note to ports section

## Description

Add note in `ports` section of file reference docs pointing to the `run` command's `--service-ports` flag

## Motivation

Spent quite a few hours spinning my wheels before I came across `run`'s `--service-ports` flag.

I'm struggling to find the issue where I found this, but the comment pointing to `--service-ports` had a lot of reacts, so this might be a relatively common 

## Things I'd still like to do

- [ ] link to the [`--service-ports` docs](https://github.com/docker/docker.github.io/blob/master/compose/reference/run.md) -- not sure how to do this
- [ ] clean up location of this note -- not sure if I've put the note in a good place -- we can shunt it to the bottom
- [ ] Duplicate for older versions

Thanks

* Minor style update

Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com>
This commit is contained in:
Zane Dufour 2021-04-23 11:17:59 -04:00 committed by GitHub
parent 66983ca5fc
commit 7e7645082e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1641,6 +1641,10 @@ Expose ports.
>
> Port mapping is incompatible with `network_mode: host`
> **Note**
>
> `docker-compose run` ignores `ports` unless you include `--service-ports`.
#### Short syntax
There are three options: