Skip to content

Commit d78521d

Browse files
Merge pull request #3914 from marcov/units-opts
cli-flags: use a consistent format for <size><unit>
2 parents f500feb + 5711aab commit d78521d

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

cmd/podman/common.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ var (
2222
)
2323

2424
const (
25-
idTruncLength = 12
25+
idTruncLength = 12
26+
sizeWithUnitFormat = "(format: `<number>[<unit>]`, where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))"
2627
)
2728

2829
func splitCamelCase(src string) string {
@@ -302,7 +303,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
302303
)
303304
createFlags.String(
304305
"kernel-memory", "",
305-
"Kernel memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g)",
306+
"Kernel memory limit "+sizeWithUnitFormat,
306307
)
307308
createFlags.StringArrayP(
308309
"label", "l", []string{},
@@ -326,11 +327,11 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
326327
)
327328
createFlags.StringP(
328329
"memory", "m", "",
329-
"Memory limit (format: <number>[<unit>], where unit = b, k, m or g)",
330+
"Memory limit "+sizeWithUnitFormat,
330331
)
331332
createFlags.String(
332333
"memory-reservation", "",
333-
"Memory soft limit (format: <number>[<unit>], where unit = b, k, m or g)",
334+
"Memory soft limit "+sizeWithUnitFormat,
334335
)
335336
createFlags.String(
336337
"memory-swap", "",
@@ -422,7 +423,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
422423
)
423424
createFlags.String(
424425
"shm-size", cliconfig.DefaultShmSize,
425-
"Size of `/dev/shm`. The format is `<number><unit>`",
426+
"Size of /dev/shm "+sizeWithUnitFormat,
426427
)
427428
createFlags.String(
428429
"stop-signal", "",

docs/podman-build.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ with 3 being roughly equivalent to using the global *--debug* option, and
281281
values below 0 omitting even error messages which accompany fatal errors.
282282

283283
**--memory**, **-m**=*LIMIT*
284-
Memory limit (format: <number>[<unit>], where unit = b, k, m or g)
284+
Memory limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
285285

286286
Allows you to constrain the memory available to a container. If the host
287287
supports swap memory, then the **-m** memory setting can be larger than physical

docs/podman-create.1.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ Default is to create a private IPC namespace (POSIX SysV IPC) for the container
379379

380380
**--kernel-memory**=*number[unit]*
381381

382-
Kernel memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g)
382+
Kernel memory limit (format: `<number>[<unit>]`, where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
383383

384384
Constrains the kernel memory available to a container. If a limit of 0
385385
is specified (not using `--kernel-memory`), the container's kernel memory
@@ -421,7 +421,7 @@ Not currently supported
421421

422422
**--memory**, **-m**=*limit*
423423

424-
Memory limit (format: <number>[<unit>], where unit = b, k, m or g)
424+
Memory limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
425425

426426
Allows you to constrain the memory available to a container. If the host
427427
supports swap memory, then the **-m** memory setting can be larger than physical
@@ -431,7 +431,7 @@ system's page size (the value would be very large, that's millions of trillions)
431431

432432
**--memory-reservation**=*limit*
433433

434-
Memory soft limit (format: <number>[<unit>], where unit = b, k, m or g)
434+
Memory soft limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
435435

436436
After setting memory reservation, when the system detects memory contention
437437
or low memory, containers are forced to restrict their consumption to their
@@ -661,9 +661,9 @@ Note: Labeling can be disabled for all containers by setting label=false in the
661661

662662
**--shm-size**=*size*
663663

664-
Size of `/dev/shm`. The format is `<number><unit>`. `number` must be greater than `0`.
665-
Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`(megabytes), or `g` (gigabytes).
664+
Size of `/dev/shm` (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
666665
If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`.
666+
When size is `0`, there is no limit on the amount of memory used for IPC by the container.
667667

668668
**--stop-signal**=*SIGTERM*
669669

docs/podman-run.1.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ Default is to create a private IPC namespace (POSIX SysV IPC) for the container
390390

391391
**--kernel-memory**=*number[unit]*
392392

393-
Kernel memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g)
393+
Kernel memory limit (format: `<number>[<unit>]`, where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
394394

395395
Constrains the kernel memory available to a container. If a limit of 0
396396
is specified (not using `--kernel-memory`), the container's kernel memory
@@ -432,7 +432,7 @@ Not currently supported
432432

433433
**--memory**, **-m**=*limit*
434434

435-
Memory limit (format: <number>[<unit>], where unit = b, k, m or g)
435+
Memory limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
436436

437437
Allows you to constrain the memory available to a container. If the host
438438
supports swap memory, then the **-m** memory setting can be larger than physical
@@ -442,7 +442,7 @@ system's page size (the value would be very large, that's millions of trillions)
442442

443443
**--memory-reservation**=*limit*
444444

445-
Memory soft limit (format: <number>[<unit>], where unit = b, k, m or g)
445+
Memory soft limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
446446

447447
After setting memory reservation, when the system detects memory contention
448448
or low memory, containers are forced to restrict their consumption to their
@@ -683,9 +683,9 @@ Note: Labeling can be disabled for all containers by setting label=false in the
683683

684684
**--shm-size**=*size*
685685

686-
Size of `/dev/shm`. The format is `<number><unit>`. `number` must be greater than `0`.
687-
Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`(megabytes), or `g` (gigabytes).
686+
Size of `/dev/shm` (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
688687
If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`.
688+
When size is `0`, there is no limit on the amount of memory used for IPC by the container.
689689

690690
**--sig-proxy**=*true|false*
691691

0 commit comments

Comments
 (0)