mirror of
https://github.com/dokku/dokku.git
synced 2026-08-29 10:08:53 +02:00
Merge pull request #8856 from youdie006/feat/ports-parsed-mappings
Add pre-parsed port_mappings to ports:report json
This commit is contained in:
@@ -221,8 +221,61 @@ You can pass flags which will output only the value of the specific information
|
||||
dokku ports:report node-js-app --ports-map
|
||||
```
|
||||
|
||||
Use `--ports-map-json` or `--ports-map-detected-json` to get the same data as a JSON array of objects. Each object has the following fields:
|
||||
|
||||
- `scheme`: the port scheme (e.g. `http`, `https`, `udp`)
|
||||
- `host_port`: the host/listener port
|
||||
- `container_port`: the container port
|
||||
|
||||
```shell
|
||||
dokku ports:report node-js-app --ports-map-json
|
||||
```
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"scheme": "http",
|
||||
"host_port": 80,
|
||||
"container_port": 5000
|
||||
},
|
||||
{
|
||||
"scheme": "https",
|
||||
"host_port": 443,
|
||||
"container_port": 5000
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
The JSON output can be processed with tools such as `jq`:
|
||||
|
||||
```shell
|
||||
dokku ports:report node-js-app --ports-map-json | jq '.[].host_port'
|
||||
```
|
||||
|
||||
```
|
||||
80
|
||||
443
|
||||
```
|
||||
|
||||
```shell
|
||||
dokku ports:report node-js-app --ports-map-detected-json | jq '.[0].container_port'
|
||||
```
|
||||
|
||||
```
|
||||
5000
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### Configured flags
|
||||
|
||||
The following flags surface configured port mappings managed by `ports:set` / `ports:add` / `ports:remove` / `ports:clear`:
|
||||
|
||||
| Flag | Description |
|
||||
|---|---|
|
||||
| `--ports-map` | Configured port mappings as space-separated `scheme:host-port:container-port` values |
|
||||
| `--ports-map-json` | Configured port mappings as a JSON array of `{scheme, host_port, container_port}` objects |
|
||||
|
||||
### Read-only flags
|
||||
|
||||
The following flags surface in `ports:report` but are not managed by `ports:set` - they are derived from the deploy:
|
||||
@@ -230,3 +283,4 @@ The following flags surface in `ports:report` but are not managed by `ports:set`
|
||||
| Flag | Description |
|
||||
|---|---|
|
||||
| `--ports-map-detected` | Port mapping inferred from `EXPOSE` directives or the running container |
|
||||
| `--ports-map-detected-json` | Detected port mappings as a JSON array of `{scheme, host_port, container_port}` objects |
|
||||
|
||||
Reference in New Issue
Block a user