1podman-pod-create(1) General Commands Manual podman-pod-create(1)
2
3
4
6 podman-pod-create - Create a new pod
7
8
10 podman pod create [options] [name]
11
12
14 Creates an empty pod, or unit of multiple containers, and prepares it
15 to have containers added to it. The pod can be created with a specific
16 name. If a name is not given a random name is generated. The pod ID is
17 printed to STDOUT. You can then use podman create --pod
18 <pod_id|pod_name> ... to add containers to the pod, and podman pod
19 start <pod_id|pod_name> to start the pod.
20
21
22 The operator can identify a pod in three ways: UUID long identifier
23 (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”)
24 UUID short identifier (“f78375b1c487”) Name (“jonah”)
25
26
27 podman generates a UUID for each pod, and if a name is not assigned to
28 the container with --name then a random string name is generated for
29 it. This name is useful to identify a pod.
30
31
32 Note: resource limit related flags work by setting the limits explic‐
33 itly in the pod's cgroup parent for all containers joining the pod. A
34 container can override the resource limits when joining a pod. For ex‐
35 ample, if a pod was created via podman pod create --cpus=5, specifying
36 podman container create --pod=<pod_id|pod_name> --cpus=4 causes the
37 container to use the smaller limit. Also, containers which specify
38 their own cgroup, such as --cgroupns=host, do NOT get the assigned pod
39 level cgroup resources.
40
41
43 --add-host=host:ip
44 Add a custom host-to-IP mapping (host:ip)
45
46
47 Add a line to /etc/hosts. The format is hostname:ip. The --add-host op‐
48 tion can be set multiple times. Conflicts with the --no-hosts option.
49
50
51 The /etc/hosts file is shared between all containers in the pod.
52
53
54 --blkio-weight=weight
55 Block IO relative weight. The weight is a value between 10 and 1000.
56
57
58 This option is not supported on cgroups V1 rootless systems.
59
60
61 --blkio-weight-device=device:weight
62 Block IO relative device weight.
63
64
65 --cgroup-parent=path
66 Path to cgroups under which the cgroup for the pod is created. If the
67 path is not absolute, the path is considered to be relative to the
68 cgroups path of the init process. Cgroups are created if they do not
69 already exist.
70
71
72 --cpu-shares, -c=shares
73 CPU shares (relative weight).
74
75
76 By default, all containers get the same proportion of CPU cycles. This
77 proportion can be modified by changing the container's CPU share
78 weighting relative to the combined weight of all the running contain‐
79 ers. Default weight is 1024.
80
81
82 The proportion only applies when CPU-intensive processes are running.
83 When tasks in one container are idle, other containers can use the
84 left-over CPU time. The actual amount of CPU time varies depending on
85 the number of containers running on the system.
86
87
88 For example, consider three containers, one has a cpu-share of 1024 and
89 two others have a cpu-share setting of 512. When processes in all three
90 containers attempt to use 100% of CPU, the first container receives 50%
91 of the total CPU time. If a fourth container is added with a cpu-share
92 of 1024, the first container only gets 33% of the CPU. The remaining
93 containers receive 16.5%, 16.5% and 33% of the CPU.
94
95
96 On a multi-core system, the shares of CPU time are distributed over all
97 CPU cores. Even if a container is limited to less than 100% of CPU
98 time, it can use 100% of each individual CPU core.
99
100
101 For example, consider a system with more than three cores. If the con‐
102 tainer C0 is started with --cpu-shares=512 running one process, and an‐
103 other container C1 with --cpu-shares=1024 running two processes, this
104 can result in the following division of CPU shares:
105
106
107 ┌────┬───────────┬─────┬──────────────┐
108 │PID │ container │ CPU │ CPU share │
109 ├────┼───────────┼─────┼──────────────┤
110 │100 │ C0 │ 0 │ 100% of CPU0 │
111 ├────┼───────────┼─────┼──────────────┤
112 │101 │ C1 │ 1 │ 100% of CPU1 │
113 ├────┼───────────┼─────┼──────────────┤
114 │102 │ C1 │ 2 │ 100% of CPU2 │
115 └────┴───────────┴─────┴──────────────┘
116
117 On some systems, changing the resource limits may not be allowed for
118 non-root users. For more details, see https://github.com/contain‐
119 ers/podman/blob/main/troubleshooting.md#26-running-containers-with-re‐
120 source-limits-fails-with-a-permissions-error
121
122
123 This option is not supported on cgroups V1 rootless systems.
124
125
126 --cpus=amount
127 Set the total number of CPUs delegated to the pod. Default is 0.000
128 which indicates that there is no limit on computation power.
129
130
131 --cpuset-cpus=number
132 CPUs in which to allow execution. Can be specified as a comma-separated
133 list (e.g. 0,1), as a range (e.g. 0-3), or any combination thereof
134 (e.g. 0-3,7,11-15).
135
136
137 On some systems, changing the resource limits may not be allowed for
138 non-root users. For more details, see https://github.com/contain‐
139 ers/podman/blob/main/troubleshooting.md#26-running-containers-with-re‐
140 source-limits-fails-with-a-permissions-error
141
142
143 This option is not supported on cgroups V1 rootless systems.
144
145
146 --cpuset-mems=nodes
147 Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effec‐
148 tive on NUMA systems.
149
150
151 If there are four memory nodes on the system (0-3), use --cpuset-
152 mems=0,1 then processes in the container only uses memory from the
153 first two memory nodes.
154
155
156 On some systems, changing the resource limits may not be allowed for
157 non-root users. For more details, see https://github.com/contain‐
158 ers/podman/blob/main/troubleshooting.md#26-running-containers-with-re‐
159 source-limits-fails-with-a-permissions-error
160
161
162 This option is not supported on cgroups V1 rootless systems.
163
164
165 --device=host-device[:container-device][:permissions]
166 Add a host device to the pod. Optional permissions parameter can be
167 used to specify device permissions by combining r for read, w for
168 write, and m for mknod(2).
169
170
171 Example: --device=/dev/sdc:/dev/xvdc:rwm.
172
173
174 Note: if host-device is a symbolic link then it is resolved first. The
175 pod only stores the major and minor numbers of the host device.
176
177
178 Podman may load kernel modules required for using the specified device.
179 The devices that Podman loads modules for when necessary are:
180 /dev/fuse.
181
182
183 In rootless mode, the new device is bind mounted in the container from
184 the host rather than Podman creating it within the container space. Be‐
185 cause the bind mount retains its SELinux label on SELinux systems, the
186 container can get permission denied when accessing the mounted device.
187 Modify SELinux settings to allow containers to use all device labels
188 via the following command:
189
190
191 $ sudo setsebool -P container_use_devices=true
192
193
194 Note: the pod implements devices by storing the initial configuration
195 passed by the user and recreating the device on each container added to
196 the pod.
197
198
199 --device-read-bps=path:rate
200 Limit read rate (in bytes per second) from a device (e.g. --device-
201 read-bps=/dev/sda:1mb).
202
203
204 On some systems, changing the resource limits may not be allowed for
205 non-root users. For more details, see https://github.com/contain‐
206 ers/podman/blob/main/troubleshooting.md#26-running-containers-with-re‐
207 source-limits-fails-with-a-permissions-error
208
209
210 This option is not supported on cgroups V1 rootless systems.
211
212
213 --device-write-bps=path:rate
214 Limit write rate (in bytes per second) to a device (e.g. --device-
215 write-bps=/dev/sda:1mb).
216
217
218 On some systems, changing the resource limits may not be allowed for
219 non-root users. For more details, see https://github.com/contain‐
220 ers/podman/blob/main/troubleshooting.md#26-running-containers-with-re‐
221 source-limits-fails-with-a-permissions-error
222
223
224 This option is not supported on cgroups V1 rootless systems.
225
226
227 --dns=ipaddr
228 Set custom DNS servers in the /etc/resolv.conf file that is shared be‐
229 tween all containers in the pod. A special option, "none" is allowed
230 which disables creation of /etc/resolv.conf for the pod.
231
232
233 --dns-option=option
234 Set custom DNS options in the /etc/resolv.conf file that is shared be‐
235 tween all containers in the pod.
236
237
238 --dns-search=domain
239 Set custom DNS search domains in the /etc/resolv.conf file that is
240 shared between all containers in the pod.
241
242
243 --exit-policy=continue | stop
244 Set the exit policy of the pod when the last container exits. Sup‐
245 ported policies are:
246
247
248 ┌────────────┬────────────────────────────┐
249 │Exit Policy │ Description │
250 ├────────────┼────────────────────────────┤
251 │continue │ The pod continues running, │
252 │ │ by keeping its infra con‐ │
253 │ │ tainer alive, when the │
254 │ │ last container exits. Used │
255 │ │ by default. │
256 ├────────────┼────────────────────────────┤
257 │stop │ The pod (including its in‐ │
258 │ │ fra container) is stopped │
259 │ │ when the last container │
260 │ │ exits. Used in kube play. │
261 └────────────┴────────────────────────────┘
262
263 --gidmap=pod_gid:host_gid:amount
264 GID map for the user namespace. Using this flag runs all containers in
265 the pod with user namespace enabled. It conflicts with the --userns
266 and --subgidname flags.
267
268
269 --help, -h
270 Print usage statement.
271
272
273 --hostname=name
274 Set a hostname to the pod.
275
276
277 --infra
278 Create an infra container and associate it with the pod. An infra con‐
279 tainer is a lightweight container used to coordinate the shared kernel
280 namespace of a pod. Default: true.
281
282
283 --infra-command=command
284 The command that is run to start the infra container. Default:
285 "/pause".
286
287
288 --infra-conmon-pidfile=file
289 Write the pid of the infra container's conmon process to a file. As
290 conmon runs in a separate process than Podman, this is necessary when
291 using systemd to manage Podman containers and pods.
292
293
294 --infra-image=image
295 The custom image that is used for the infra container. Unless speci‐
296 fied, Podman builds a custom local image which does not require pulling
297 down an image.
298
299
300 --infra-name=name
301 The name that is used for the pod's infra container.
302
303
304 --ip=ipv4
305 Specify a static IPv4 address for the pod, for example 10.88.64.128.
306 This option can only be used if the pod is joined to only a single net‐
307 work - i.e., --network=network-name is used at most once - and if the
308 pod is not joining another container's network namespace via --net‐
309 work=container:id. The address must be within the network's IP address
310 pool (default 10.88.0.0/16).
311
312
313 To specify multiple static IP addresses per pod, set multiple networks
314 using the --network option with a static IP address specified for each
315 using the ip mode for that option.
316
317
318 --ip6=ipv6
319 Specify a static IPv6 address for the pod, for example
320 fd46:db93:aa76:ac37::10. This option can only be used if the pod is
321 joined to only a single network - i.e., --network=network-name is used
322 at most once - and if the pod is not joining another container's net‐
323 work namespace via --network=container:id. The address must be within
324 the network's IPv6 address pool.
325
326
327 To specify multiple static IPv6 addresses per pod, set multiple net‐
328 works using the --network option with a static IPv6 address specified
329 for each using the ip6 mode for that option.
330
331
332 --label, -l=key=value
333 Add metadata to a pod.
334
335
336 --label-file=file
337 Read in a line-delimited file of labels.
338
339
340 --mac-address=address
341 Pod network interface MAC address (e.g. 92:d0:c6:0a:29:33) This option
342 can only be used if the pod is joined to only a single network - i.e.,
343 --network=network-name is used at most once - and if the pod is not
344 joining another container's network namespace via --network=con‐
345 tainer:id.
346
347
348 Remember that the MAC address in an Ethernet network must be unique.
349 The IPv6 link-local address is based on the device's MAC address ac‐
350 cording to RFC4862.
351
352
353 To specify multiple static MAC addresses per pod, set multiple networks
354 using the --network option with a static MAC address specified for each
355 using the mac mode for that option.
356
357
358 --memory, -m=number[unit]
359 Memory limit. A unit can be b (bytes), k (kibibytes), m (mebibytes), or
360 g (gibibytes).
361
362
363 Allows the memory available to a container to be constrained. If the
364 host supports swap memory, then the -m memory setting can be larger
365 than physical RAM. If a limit of 0 is specified (not using -m), the
366 container's memory is not limited. The actual limit may be rounded up
367 to a multiple of the operating system's page size (the value is very
368 large, that's millions of trillions).
369
370
371 This option is not supported on cgroups V1 rootless systems.
372
373
374 --memory-swap=number[unit]
375 A limit value equal to memory plus swap. A unit can be b (bytes), k
376 (kibibytes), m (mebibytes), or g (gibibytes).
377
378
379 Must be used with the -m (--memory) flag. The argument value must be
380 larger than that of
381 -m (--memory) By default, it is set to double the value of --memory.
382
383
384 Set number to -1 to enable unlimited swap.
385
386
387 This option is not supported on cgroups V1 rootless systems.
388
389
390 --name, -n=name
391 Assign a name to the pod.
392
393
394 --network=mode, --net
395 Set the network mode for the pod.
396
397
398 Valid mode values are:
399
400
401 • bridge[:OPTIONS,...]: Create a network stack on the default
402 bridge. This is the default for rootful containers. It is pos‐
403 sible to specify these additional options:
404
405 • alias=name: Add network-scoped alias for the container.
406
407 • ip=IPv4: Specify a static ipv4 address for this container.
408
409 • ip=IPv6: Specify a static ipv6 address for this container.
410
411 • mac=MAC: Specify a static mac address for this container.
412
413 • interface_name: Specify a name for the created network in‐
414 terface inside the container.
415
416 For example to set a static ipv4 address and a static mac ad‐
417 dress, use --network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99.
418
419 • <network name or ID>[:OPTIONS,...]: Connect to a user-defined
420 network; this is the network name or ID from a network created
421 by podman network create. Using the network name implies the
422 bridge network mode. It is possible to specify the same op‐
423 tions described under the bridge mode above. Use the --network
424 option multiple times to specify additional networks. For
425 backwards compatibility it is also possible to specify net‐
426 works comma separated on the first --network argument, however
427 this prevents you from using the options described under the
428 bridge section above.
429
430 • none: Create a network namespace for the container but do not
431 configure network interfaces for it, thus the container has no
432 network connectivity.
433
434 • container:id: Reuse another container's network stack.
435
436 • host: Do not create a network namespace, the container uses
437 the host's network. Note: The host mode gives the container
438 full access to local system services such as D-bus and is
439 therefore considered insecure.
440
441 • ns:path: Path to a network namespace to join.
442
443 • private: Create a new namespace for the container. This uses
444 the bridge mode for rootful containers and slirp4netns for
445 rootless ones.
446
447 • slirp4netns[:OPTIONS,...]: use slirp4netns(1) to create a user
448 network stack. This is the default for rootless containers. It
449 is possible to specify these additional options, they can also
450 be set with network_cmd_options in containers.conf:
451
452 • allow_host_loopback=true|false: Allow slirp4netns to reach
453 the host loopback IP (default is 10.0.2.2 or the second IP
454 from slirp4netns cidr subnet when changed, see the cidr op‐
455 tion below). The default is false.
456
457 • mtu=MTU: Specify the MTU to use for this network. (Default
458 is 65520).
459
460 • cidr=CIDR: Specify ip range to use for this network. (De‐
461 fault is 10.0.2.0/24).
462
463 • enable_ipv6=true|false: Enable IPv6. Default is true. (Re‐
464 quired for outbound_addr6).
465
466 • outbound_addr=INTERFACE: Specify the outbound interface
467 slirp binds to (ipv4 traffic only).
468
469 • outbound_addr=IPv4: Specify the outbound ipv4 address slirp
470 binds to.
471
472 • outbound_addr6=INTERFACE: Specify the outbound interface
473 slirp binds to (ipv6 traffic only).
474
475 • outbound_addr6=IPv6: Specify the outbound ipv6 address slirp
476 binds to.
477
478 • port_handler=rootlesskit: Use rootlesskit for port forward‐
479 ing. Default. Note: Rootlesskit changes the source IP ad‐
480 dress of incoming packets to an IP address in the container
481 network namespace, usually 10.0.2.100. If the application
482 requires the real source IP address, e.g. web server logs,
483 use the slirp4netns port handler. The rootlesskit port han‐
484 dler is also used for rootless containers when connected to
485 user-defined networks.
486
487 • port_handler=slirp4netns: Use the slirp4netns port forward‐
488 ing, it is slower than rootlesskit but preserves the correct
489 source IP address. This port handler cannot be used for
490 user-defined networks.
491
492
493
494 • pasta[:OPTIONS,...]: use pasta(1) to create a user-mode net‐
495 working stack.
496 This is only supported in rootless mode.
497 By default, IPv4 and IPv6 addresses and routes, as well as the
498 pod interface name, are copied from the host. If port forward‐
499 ing isn't configured, ports are forwarded dynamically as ser‐
500 vices are bound on either side (init namespace or container
501 namespace). Port forwarding preserves the original source IP
502 address. Options described in pasta(1) can be specified as
503 comma-separated arguments.
504 In terms of pasta(1) options, --config-net is given by de‐
505 fault, in order to configure networking when the container is
506 started, and --no-map-gw is also assumed by default, to avoid
507 direct access from container to host using the gateway ad‐
508 dress. The latter can be overridden by passing --map-gw in the
509 pasta-specific options (despite not being an actual pasta(1)
510 option).
511 Also, -t none and -u none are passed if, respectively, no TCP
512 or UDP port forwarding from host to container is configured,
513 to disable automatic port forwarding based on bound ports.
514 Similarly, -T none and -U none are given to disable the same
515 functionality from container to host.
516 Some examples:
517
518 • pasta:--map-gw: Allow the container to directly reach the
519 host using the gateway address.
520
521 • pasta:--mtu,1500: Specify a 1500 bytes MTU for the tap in‐
522 terface in the container.
523
524 • pasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-for‐
525 ward,10.0.2.3,-m,1500,--no-ndp,--no-dhcpv6,--no-dhcp, equiv‐
526 alent to default slirp4netns(1) options: disable IPv6, as‐
527 sign 10.0.2.0/24 to the tap0 interface in the container,
528 with gateway 10.0.2.3, enable DNS forwarder reachable at
529 10.0.2.3, set MTU to 1500 bytes, disable NDP, DHCPv6 and
530 DHCP support.
531
532 • pasta:-I,tap0,--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-
533 forward,10.0.2.3,--no-ndp,--no-dhcpv6,--no-dhcp, equivalent
534 to default slirp4netns(1) options with Podman overrides:
535 same as above, but leave the MTU to 65520 bytes
536
537 • pasta:-t,auto,-u,auto,-T,auto,-U,auto: enable automatic port
538 forwarding based on observed bound ports from both host and
539 container sides
540
541 • pasta:-T,5201: enable forwarding of TCP port 5201 from con‐
542 tainer to host, using the loopback interface instead of the
543 tap interface for improved performance
544
545 NOTE: For backward compatibility reasons, if there is an exist‐
546 ing network named pasta, Podman uses it instead of the pasta
547 mode."?
548
549
550
551 Invalid if using --dns, --dns-option, or --dns-search with --network
552 set to none or container:id.
553
554
555 --network-alias=alias
556 Add a network-scoped alias for the pod, setting the alias for all net‐
557 works that the container joins. To set a name only for a specific net‐
558 work, use the alias option as described under the --network option. If
559 the network has DNS enabled (podman network inspect -f {{.DNSEnabled}}
560 <name>), these aliases can be used for name resolution on the given
561 network. This option can be specified multiple times. NOTE: When using
562 CNI a pod only has access to aliases on the first network that it
563 joins. This limitation does not exist with netavark/aardvark-dns.
564
565
566 --no-hosts
567 Do not create /etc/hosts for the pod. By default, Podman manages
568 /etc/hosts, adding the container's own IP address and any hosts from
569 --add-host. --no-hosts disables this, and the image's /etc/hosts is
570 preserved unmodified.
571
572
573 This option conflicts with --add-host.
574
575
576 --pid=pid
577 Set the PID mode for the pod. The default is to create a private PID
578 namespace for the pod. Requires the PID namespace to be shared via
579 --share.
580
581
582 host: use the host’s PID namespace for the pod
583 ns: join the specified PID namespace
584 private: create a new namespace for the pod (default)
585
586
587
588 --pod-id-file=path
589 Write the pod ID to the file.
590
591
592 --publish, -p=[[ip:][hostPort]:]containerPort[/protocol]
593 Publish a container's port, or range of ports, within this pod to the
594 host.
595
596
597 Both hostPort and containerPort can be specified as a range of ports.
598 When specifying ranges for both, the number of container ports in the
599 range must match the number of host ports in the range.
600
601
602 If host IP is set to 0.0.0.0 or not set at all, the port is bound on
603 all IPs on the host.
604
605
606 By default, Podman publishes TCP ports. To publish a UDP port instead,
607 give udp as protocol. To publish both TCP and UDP ports, set --publish
608 twice, with tcp, and udp as protocols respectively. Rootful containers
609 can also publish ports using the sctp protocol.
610
611
612 Host port does not have to be specified (e.g. podman run -p
613 127.0.0.1::80). If it is not, the container port is randomly assigned
614 a port on the host.
615
616
617 Use podman port to see the actual mapping: podman port $CONTAINER $CON‐
618 TAINERPORT.
619
620
621 Note: You must not publish ports of containers in the pod individually,
622 but only by the pod itself.
623
624
625 Note: This cannot be modified once the pod is created.
626
627
628 --replace
629 If another pod with the same name already exists, replace and remove
630 it. The default is false.
631
632
633 --restart=policy
634 Restart policy to follow when containers exit. Restart policy does not
635 take effect if a container is stopped via the podman kill or podman
636 stop commands.
637
638
639 Valid policy values are:
640
641
642 • no : Do not restart containers on exit
643
644 • never : Synonym for no; do not restart con‐
645 tainers on exit
646
647 • on-failure[:max_retries] : Restart containers when they exit
648 with a non-zero exit code, retrying indefinitely or until the
649 optional max_retries count is hit
650
651 • always : Restart containers when they exit,
652 regardless of status, retrying indefinitely
653
654 • unless-stopped : Identical to always
655
656
657
658 Podman provides a systemd unit file, podman-restart.service, which
659 restarts containers after a system reboot.
660
661
662 When running containers in systemd services, use the restart function‐
663 ality provided by systemd. In other words, do not use this option in a
664 container unit, instead set the Restart= systemd directive in the [Ser‐
665 vice] section. See podman-systemd.unit(5) and systemd.service(5).
666
667
668 Default restart policy for all the containers in a pod.
669
670
671 --security-opt=option
672 Security Options
673
674
675 • apparmor=unconfined : Turn off apparmor confinement for the
676 pod
677
678 • apparmor=alternate-profile : Set the apparmor confinement pro‐
679 file for the pod
680
681 • label=user:USER: Set the label user for the pod processes
682
683 • label=role:ROLE: Set the label role for the pod processes
684
685 • label=type:TYPE: Set the label process type for the pod pro‐
686 cesses
687
688 • label=level:LEVEL: Set the label level for the pod processes
689
690 • label=filetype:TYPE: Set the label file type for the pod files
691
692 • label=disable: Turn off label separation for the pod
693
694
695
696 Note: Labeling can be disabled for all pods/containers by setting la‐
697 bel=false in the containers.conf (/etc/containers/containers.conf or
698 $HOME/.config/containers/containers.conf) file.
699
700
701 • label=nested: Allows SELinux modifications within the con‐
702 tainer. Containers are allowed to modify SELinux labels on
703 files and processes, as long as SELinux policy allows. Without
704 nested, containers view SELinux as disabled, even when it is
705 enabled on the host. Containers are prevented from setting any
706 labels.
707
708 • mask=/path/1:/path/2: The paths to mask separated by a colon.
709 A masked path cannot be accessed inside the containers within
710 the pod.
711
712 • no-new-privileges: Disable container processes from gaining
713 additional privileges.
714
715 • seccomp=unconfined: Turn off seccomp confinement for the pod.
716
717 • seccomp=profile.json: JSON file to be used as a seccomp fil‐
718 ter. Note that the io.podman.annotations.seccomp annotation is
719 set with the specified value as shown in podman inspect.
720
721 • proc-opts=OPTIONS : Comma-separated list of options to use for
722 the /proc mount. More details for the possible mount options
723 are specified in the proc(5) man page.
724
725 • unmask=ALL or /path/1:/path/2, or shell expanded paths
726 (/proc/*): Paths to unmask separated by a colon. If set to
727 ALL, it unmasks all the paths that are masked or made read-
728 only by default. The default masked paths are /proc/acpi,
729 /proc/kcore, /proc/keys, /proc/latency_stats, /proc/sched_de‐
730 bug, /proc/scsi, /proc/timer_list, /proc/timer_stats,
731 /sys/firmware, and /sys/fs/selinux. The default paths that
732 are read-only are /proc/asound, /proc/bus, /proc/fs,
733 /proc/irq, /proc/sys, /proc/sysrq-trigger, /sys/fs/cgroup.
734
735
736
737 Note: Labeling can be disabled for all containers by setting la‐
738 bel=false in the containers.conf(5) file.
739
740
741 --share=namespace
742 A comma-separated list of kernel namespaces to share. If none or "" is
743 specified, no namespaces are shared, and the infra container is not
744 created unless explicitly specified via --infra=true. The namespaces to
745 choose from are cgroup, ipc, net, pid, uts. If the option is prefixed
746 with a "+", the namespace is appended to the default list. Otherwise,
747 it replaces the default list. Defaults match Kubernetes default (ipc,
748 net, uts)
749
750
751 --share-parent
752 This boolean determines whether or not all containers entering the pod
753 use the pod as their cgroup parent. The default value of this option is
754 true. Use the --share option to share the cgroup namespace rather than
755 a cgroup parent in a pod.
756
757
758 Note: This option conflicts with the --share=cgroup option since that
759 option sets the pod as the cgroup parent but enters the container into
760 the same cgroupNS as the infra container.
761
762
763 --shm-size=number[unit]
764 Size of /dev/shm. A unit can be b (bytes), k (kibibytes), m
765 (mebibytes), or g (gibibytes). If the unit is omitted, the system uses
766 bytes. If the size is omitted, the default is 64m. When size is 0,
767 there is no limit on the amount of memory used for IPC by the pod.
768 This option conflicts with --ipc=host.
769
770
771 --shm-size-systemd=number[unit]
772 Size of systemd-specific tmpfs mounts such as /run, /run/lock,
773 /var/log/journal and /tmp. A unit can be b (bytes), k (kibibytes), m
774 (mebibytes), or g (gibibytes). If the unit is omitted, the system uses
775 bytes. If the size is omitted, the default is 64m. When size is 0, the
776 usage is limited to 50% of the host's available memory.
777
778
779 --subgidname=name
780 Run the container in a new user namespace using the map with name in
781 the /etc/subgid file. If running rootless, the user needs to have the
782 right to use the mapping. See subgid(5). This flag conflicts with
783 --userns and --gidmap.
784
785
786 --subuidname=name
787 Run the container in a new user namespace using the map with name in
788 the /etc/subuid file. If running rootless, the user needs to have the
789 right to use the mapping. See subuid(5). This flag conflicts with
790 --userns and --uidmap.
791
792
793 --sysctl=name=value
794 Configure namespaced kernel parameters for all containers in the pod.
795
796
797 For the IPC namespace, the following sysctls are allowed:
798
799
800 • kernel.msgmax
801
802 • kernel.msgmnb
803
804 • kernel.msgmni
805
806 • kernel.sem
807
808 • kernel.shmall
809
810 • kernel.shmmax
811
812 • kernel.shmmni
813
814 • kernel.shm_rmid_forced
815
816 • Sysctls beginning with fs.mqueue.*
817
818
819
820 Note: if the ipc namespace is not shared within the pod, the above
821 sysctls are not allowed.
822
823
824 For the network namespace, only sysctls beginning with net.* are al‐
825 lowed.
826
827
828 Note: if the network namespace is not shared within the pod, the above
829 sysctls are not allowed.
830
831
832 --uidmap=container_uid:from_uid:amount
833 Run all containers in the pod in a new user namespace using the sup‐
834 plied mapping. This option conflicts with the --userns and --subuidname
835 options. This option provides a way to map host UIDs to container UIDs.
836 It can be passed several times to map different ranges.
837
838
839 --userns=mode
840 Set the user namespace mode for all the containers in a pod. It de‐
841 faults to the PODMAN_USERNS environment variable. An empty value ("")
842 means user namespaces are disabled.
843
844
845 Rootless user --userns=Key mappings:
846
847
848 ┌────────┬───────────┬─────────────────────┐
849 │Key │ Host User │ Container User │
850 ├────────┼───────────┼─────────────────────┤
851 │"" │ $UID │ 0 (Default User ac‐ │
852 │ │ │ count mapped to │
853 │ │ │ root user in con‐ │
854 │ │ │ tainer.) │
855 ├────────┼───────────┼─────────────────────┤
856 │keep-id │ $UID │ $UID (Map user ac‐ │
857 │ │ │ count to same UID │
858 │ │ │ within container.) │
859 ├────────┼───────────┼─────────────────────┤
860 │auto │ $UID │ nil (Host User UID │
861 │ │ │ is not mapped into │
862 │ │ │ container.) │
863 ├────────┼───────────┼─────────────────────┤
864 │nomap │ $UID │ nil (Host User UID │
865 │ │ │ is not mapped into │
866 │ │ │ container.) │
867 └────────┴───────────┴─────────────────────┘
868
869 Valid mode values are:
870
871
872 • auto[:OPTIONS,...]: automatically create a namespace. It is
873 possible to specify these options to auto:
874
875 • gidmapping=CONTAINER_GID:HOST_GID:SIZE to force a GID mapping
876 to be present in the user namespace.
877
878 • size=SIZE: to specify an explicit size for the automatic user
879 namespace. e.g. --userns=auto:size=8192. If size is not speci‐
880 fied, auto estimates the size for the user namespace.
881
882 • uidmapping=CONTAINER_UID:HOST_UID:SIZE to force a UID mapping
883 to be present in the user namespace.
884
885 • host: run in the user namespace of the caller. The processes
886 running in the container have the same privileges on the host
887 as any other process launched by the calling user (default).
888
889 • keep-id: creates a user namespace where the current rootless
890 user's UID:GID are mapped to the same values in the container.
891 This option is not allowed for containers created by the root
892 user.
893
894 • nomap: creates a user namespace where the current rootless
895 user's UID:GID are not mapped into the container. This option
896 is not allowed for containers created by the root user.
897
898
899
900 --uts=mode
901 Set the UTS namespace mode for the pod. The following values are sup‐
902 ported:
903
904
905 • host: use the host's UTS namespace inside the pod.
906
907 • private: create a new namespace for the pod (default).
908
909 • ns:[path]: run the pod in the given existing UTS namespace.
910
911
912
913 --volume, -v=[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]
914 Create a bind mount. If -v /HOST-DIR:/CONTAINER-DIR is specified, Pod‐
915 man bind mounts /HOST-DIR from the host into /CONTAINER-DIR in the Pod‐
916 man container. Similarly, -v SOURCE-VOLUME:/CONTAINER-DIR mounts the
917 named volume from the host into the container. If no such named volume
918 exists, Podman creates one. If no source is given, the volume is cre‐
919 ated as an anonymously named volume with a randomly generated name, and
920 is removed when the pod is removed via the --rm flag or the podman rm
921 --volumes command.
922
923
924 (Note when using the remote client, including Mac and Windows (exclud‐
925 ing WSL2) machines, the volumes are mounted from the remote server, not
926 necessarily the client machine.)
927
928
929 The OPTIONS is a comma-separated list and can be: [1] ⟨#Footnote1⟩
930
931
932 • rw|ro
933
934 • z|Z
935
936 • [O]
937
938 • [U]
939
940 • [no]copy
941
942 • [no]dev
943
944 • [no]exec
945
946 • [no]suid
947
948 • [r]bind
949
950 • [r]shared|[r]slave|[r]private[r]unbindable
951
952 • idmap[=options]
953
954
955
956 The CONTAINER-DIR must be an absolute path such as /src/docs. The vol‐
957 ume is mounted into the container at this directory.
958
959
960 If a volume source is specified, it must be a path on the host or the
961 name of a named volume. Host paths are allowed to be absolute or rela‐
962 tive; relative paths are resolved relative to the directory Podman is
963 run in. If the source does not exist, Podman returns an error. Users
964 must pre-create the source files or directories.
965
966
967 Any source that does not begin with a . or / is treated as the name of
968 a named volume. If a volume with that name does not exist, it is cre‐
969 ated. Volumes created with names are not anonymous, and they are not
970 removed by the --rm option and the podman rm --volumes command.
971
972
973 Specify multiple -v options to mount one or more volumes into a pod.
974
975
976 Write Protected Volume Mounts
977
978
979 Add :ro or :rw option to mount a volume in read-only or read-write
980 mode, respectively. By default, the volumes are mounted read-write.
981 See examples.
982
983
984 Chowning Volume Mounts
985
986
987 By default, Podman does not change the owner and group of source volume
988 directories mounted into containers. If a pod is created in a new user
989 namespace, the UID and GID in the container may correspond to another
990 UID and GID on the host.
991
992
993 The :U suffix tells Podman to use the correct host UID and GID based on
994 the UID and GID within the pod, to change recursively the owner and
995 group of the source volume. Chowning walks the file system under the
996 volume and changes the UID/GID on each file. If the volume has thou‐
997 sands of inodes, this process takes a long time, delaying the start of
998 the pod.
999
1000
1001 Warning use with caution since this modifies the host filesystem.
1002
1003
1004 Labeling Volume Mounts
1005
1006
1007 Labeling systems like SELinux require that proper labels are placed on
1008 volume content mounted into a pod. Without a label, the security system
1009 might prevent the processes running inside the pod from using the con‐
1010 tent. By default, Podman does not change the labels set by the OS.
1011
1012
1013 To change a label in the pod context, add either of two suffixes :z or
1014 :Z to the volume mount. These suffixes tell Podman to relabel file ob‐
1015 jects on the shared volumes. The z option tells Podman that two or more
1016 pods share the volume content. As a result, Podman labels the content
1017 with a shared content label. Shared volume labels allow all containers
1018 to read/write content. The Z option tells Podman to label the content
1019 with a private unshared label Only the current pod can use a private
1020 volume. Relabeling walks the file system under the volume and changes
1021 the label on each file, if the volume has thousands of inodes, this
1022 process takes a long time, delaying the start of the pod. If the volume
1023 was previously relabeled with the z option, Podman is optimized to not
1024 relabel a second time. If files are moved into the volume, then the la‐
1025 bels can be manually change with the chcon -R container_file_t PATH
1026 command.
1027
1028
1029 Note: Do not relabel system files and directories. Relabeling system
1030 content might cause other confined services on the machine to fail.
1031 For these types of containers we recommend disabling SELinux separa‐
1032 tion. The option --security-opt label=disable disables SELinux separa‐
1033 tion for the pod. For example if a user wanted to volume mount their
1034 entire home directory into a pod, they need to disable SELinux separa‐
1035 tion.
1036
1037
1038 $ podman pod create --security-opt label=disable -v $HOME:/home/user fedora touch /home/user/file
1039
1040
1041
1042 Overlay Volume Mounts
1043
1044
1045 The :O flag tells Podman to mount the directory from the host as a tem‐
1046 porary storage using the overlay file system. The pod processes can
1047 modify content within the mountpoint which is stored in the container
1048 storage in a separate directory. In overlay terms, the source directory
1049 is the lower, and the container storage directory is the upper. Modifi‐
1050 cations to the mount point are destroyed when the pod finishes execut‐
1051 ing, similar to a tmpfs mount point being unmounted.
1052
1053
1054 For advanced users, the overlay option also supports custom non-
1055 volatile upperdir and workdir for the overlay mount. Custom upperdir
1056 and workdir can be fully managed by the users themselves, and Podman
1057 does not remove it on lifecycle completion. Example :O,up‐
1058 perdir=/some/upper,workdir=/some/work
1059
1060
1061 Subsequent executions of the container sees the original source direc‐
1062 tory content, any changes from previous pod executions no longer exist.
1063
1064
1065 One use case of the overlay mount is sharing the package cache from the
1066 host into the container to allow speeding up builds.
1067
1068
1069 Note: The O flag conflicts with other options listed above.
1070
1071
1072 Content mounted into the container is labeled with the private label.
1073 On SELinux systems, labels in the source directory must be read‐
1074 able by the pod infra container label. Usually containers can read/exe‐
1075 cute container_share_t and can read/write container_file_t. If unable
1076 to change the labels on a source volume, SELinux container separation
1077 must be disabled for the pod or infra container to work.
1078 - Do not modify the source directory mounted into the pod with an
1079 overlay mount, it can cause unexpected failures. Only modify the direc‐
1080 tory after the container finishes running.
1081
1082
1083 Mounts propagation
1084
1085
1086 By default bind mounted volumes are private. That means any mounts done
1087 inside the pod is not visible on host and vice versa. One can change
1088 this behavior by specifying a volume mount propagation property. Making
1089 a volume shared mounts done under that volume inside the pod is visible
1090 on host and vice versa. Making a volume slave enables only one way
1091 mount propagation and that is mounts done on host under that volume is
1092 visible inside container but not the other way around. [1] ⟨#Footnote1⟩
1093
1094
1095 To control mount propagation property of a volume one can use the
1096 [r]shared, [r]slave, [r]private or the [r]unbindable propagation flag.
1097 Propagation property can be specified only for bind mounted volumes and
1098 not for internal volumes or named volumes. For mount propagation to
1099 work the source mount point (the mount point where source dir is
1100 mounted on) has to have the right propagation properties. For shared
1101 volumes, the source mount point has to be shared. And for slave vol‐
1102 umes, the source mount point has to be either shared or slave. [1]
1103 ⟨#Footnote1⟩
1104
1105
1106 To recursively mount a volume and all of its submounts into a pod, use
1107 the rbind option. By default the bind option is used, and submounts of
1108 the source directory is not mounted into the pod.
1109
1110
1111 Mounting the volume with a copy option tells podman to copy content
1112 from the underlying destination directory onto newly created internal
1113 volumes. The copy only happens on the initial creation of the volume.
1114 Content is not copied up when the volume is subsequently used on dif‐
1115 ferent containers. The copy option is ignored on bind mounts and has no
1116 effect.
1117
1118
1119 Mounting volumes with the nosuid options means that SUID executables on
1120 the volume can not be used by applications to change their privilege.
1121 By default volumes are mounted with nosuid.
1122
1123
1124 Mounting the volume with the noexec option means that no executables on
1125 the volume can be executed within the pod.
1126
1127
1128 Mounting the volume with the nodev option means that no devices on the
1129 volume can be used by processes within the pod. By default volumes are
1130 mounted with nodev.
1131
1132
1133 If the HOST-DIR is a mount point, then dev, suid, and exec options are
1134 ignored by the kernel.
1135
1136
1137 Use df HOST-DIR to figure out the source mount, then use findmnt -o
1138 TARGET,PROPAGATION source-mount-dir to figure out propagation proper‐
1139 ties of source mount. If findmnt[4m(1) utility is not available, then one
1140 can look at the mount entry for the source mount point in
1141 /proc/self/mountinfo. Look at the "optional fields" and see if any
1142 propagation properties are specified. In there, shared:N means the
1143 mount is shared, master:N means mount is slave, and if nothing is
1144 there, the mount is private. [1] ⟨#Footnote1⟩
1145
1146
1147 To change propagation properties of a mount point, use mount(8) com‐
1148 mand. For example, if one wants to bind mount source directory /foo,
1149 one can do mount --bind /foo /foo and mount --make-private --make-
1150 shared /foo. This converts /foo into a shared mount point. Alterna‐
1151 tively, one can directly change propagation properties of source mount.
1152 Say / is source mount for /foo, then use mount --make-shared / to con‐
1153 vert / into a shared mount.
1154
1155
1156 Note: if the user only has access rights via a group, accessing the
1157 volume from inside a rootless pod fails.
1158
1159
1160 Idmapped mount
1161
1162
1163 If idmap is specified, create an idmapped mount to the target user
1164 namespace in the container. The idmap option supports a custom mapping
1165 that can be different than the user namespace used by the container.
1166 The mapping can be specified after the idmap option like:
1167 idmap=uids=0-1-10#10-11-10;gids=0-100-10. For each triplet, the first
1168 value is the start of the backing file system IDs that are mapped to
1169 the second value on the host. The length of this mapping is given in
1170 the third value. Multiple ranges are separated with #.
1171
1172
1173 --volumes-from=CONTAINER[:OPTIONS]
1174 Mount volumes from the specified container(s). Used to share volumes
1175 between containers and pods. The options is a comma-separated list with
1176 the following available elements:
1177
1178
1179 • rw|ro
1180
1181 • z
1182
1183
1184
1185 Mounts already mounted volumes from a source container onto another
1186 pod. CONTAINER may be a name or ID. To share a volume, use the --vol‐
1187 umes-from option when running the target container. Volumes can be
1188 shared even if the source container is not running.
1189
1190
1191 By default, Podman mounts the volumes in the same mode (read-write or
1192 read-only) as it is mounted in the source container. This can be
1193 changed by adding a ro or rw option.
1194
1195
1196 Labeling systems like SELinux require that proper labels are placed on
1197 volume content mounted into a pod. Without a label, the security system
1198 might prevent the processes running inside the container from using the
1199 content. By default, Podman does not change the labels set by the OS.
1200
1201
1202 To change a label in the pod context, add z to the volume mount. This
1203 suffix tells Podman to relabel file objects on the shared volumes. The
1204 z option tells Podman that two entities share the volume content. As a
1205 result, Podman labels the content with a shared content label. Shared
1206 volume labels allow all containers to read/write content.
1207
1208
1209 If the location of the volume from the source container overlaps with
1210 data residing on a target pod, then the volume hides that data on the
1211 target.
1212
1213
1215 $ podman pod create --name test
1216
1217 $ podman pod create mypod
1218
1219 $ podman pod create --infra=false
1220
1221 $ podman pod create --infra-command /top toppod
1222
1223 $ podman pod create --publish 8443:443
1224
1225 $ podman pod create --network slirp4netns:outbound_addr=127.0.0.1,allow_host_loopback=true
1226
1227 $ podman pod create --network slirp4netns:cidr=192.168.0.0/24
1228
1229 $ podman pod create --network pasta
1230
1231 $ podman pod create --network net1:ip=10.89.1.5 --network net2:ip=10.89.10.10
1232
1233
1234
1236 podman(1), podman-pod(1), podman-kube-play(1), containers.conf(1),
1237 cgroups(7)
1238
1239
1241 July 2018, Originally compiled by Peter Hunt pehunt@redhat.com
1242 ⟨mailto:pehunt@redhat.com⟩
1243
1244
1246 1: The Podman project is committed to inclusivity, a core value of open
1247 source. The master and slave mount propagation terminology used here is
1248 problematic and divisive, and needs to be changed. However, these terms
1249 are currently used within the Linux kernel and must be used as-is at
1250 this time. When the kernel maintainers rectify this usage, Podman will
1251 follow suit immediately.
1252
1253
1254
1255 podman-pod-create(1)