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 host: use the host’s PID namespace for the pod
582 ns: join the specified PID namespace
583 private: create a new namespace for the pod (default)
584
585
586
587 --pod-id-file=path
588 Write the pod ID to the file.
589
590
591 --publish, -p=[[ip:][hostPort]:]containerPort[/protocol]
592 Publish a container's port, or range of ports, within this pod to the
593 host.
594
595
596 Both hostPort and containerPort can be specified as a range of ports.
597 When specifying ranges for both, the number of container ports in the
598 range must match the number of host ports in the range.
599
600
601 If host IP is set to 0.0.0.0 or not set at all, the port is bound on
602 all IPs on the host.
603
604
605 By default, Podman publishes TCP ports. To publish a UDP port instead,
606 give udp as protocol. To publish both TCP and UDP ports, set --publish
607 twice, with tcp, and udp as protocols respectively. Rootful containers
608 can also publish ports using the sctp protocol.
609
610
611 Host port does not have to be specified (e.g. podman run -p
612 127.0.0.1::80). If it is not, the container port is randomly assigned
613 a port on the host.
614
615
616 Use podman port to see the actual mapping: podman port $CONTAINER $CON‐
617 TAINERPORT.
618
619
620 Note that the network drivers macvlan and ipvlan do not support port
621 forwarding, it will have no effect on these networks.
622
623
624 Note: You must not publish ports of containers in the pod individually,
625 but only by the pod itself.
626
627
628 Note: This cannot be modified once the pod is created.
629
630
631 --replace
632 If another pod with the same name already exists, replace and remove
633 it. The default is false.
634
635
636 --restart=policy
637 Restart policy to follow when containers exit. Restart policy does not
638 take effect if a container is stopped via the podman kill or podman
639 stop commands.
640
641
642 Valid policy values are:
643
644
645 • no : Do not restart containers on exit
646
647 • never : Synonym for no; do not restart con‐
648 tainers on exit
649
650 • on-failure[:max_retries] : Restart containers when they exit
651 with a non-zero exit code, retrying indefinitely or until the
652 optional max_retries count is hit
653
654 • always : Restart containers when they exit,
655 regardless of status, retrying indefinitely
656
657 • unless-stopped : Identical to always
658
659
660
661 Podman provides a systemd unit file, podman-restart.service, which
662 restarts containers after a system reboot.
663
664
665 When running containers in systemd services, use the restart function‐
666 ality provided by systemd. In other words, do not use this option in a
667 container unit, instead set the Restart= systemd directive in the [Ser‐
668 vice] section. See podman-systemd.unit(5) and systemd.service(5).
669
670
671 Default restart policy for all the containers in a pod.
672
673
674 --security-opt=option
675 Security Options
676
677
678 • apparmor=unconfined : Turn off apparmor confinement for the
679 pod
680
681 • apparmor=alternate-profile : Set the apparmor confinement pro‐
682 file for the pod
683
684 • label=user:USER: Set the label user for the pod processes
685
686 • label=role:ROLE: Set the label role for the pod processes
687
688 • label=type:TYPE: Set the label process type for the pod pro‐
689 cesses
690
691 • label=level:LEVEL: Set the label level for the pod processes
692
693 • label=filetype:TYPE: Set the label file type for the pod files
694
695 • label=disable: Turn off label separation for the pod
696
697
698
699 Note: Labeling can be disabled for all pods/containers by setting la‐
700 bel=false in the containers.conf (/etc/containers/containers.conf or
701 $HOME/.config/containers/containers.conf) file.
702
703
704 • label=nested: Allows SELinux modifications within the con‐
705 tainer. Containers are allowed to modify SELinux labels on
706 files and processes, as long as SELinux policy allows. Without
707 nested, containers view SELinux as disabled, even when it is
708 enabled on the host. Containers are prevented from setting any
709 labels.
710
711 • mask=/path/1:/path/2: The paths to mask separated by a colon.
712 A masked path cannot be accessed inside the containers within
713 the pod.
714
715 • no-new-privileges: Disable container processes from gaining
716 additional privileges.
717
718 • seccomp=unconfined: Turn off seccomp confinement for the pod.
719
720 • seccomp=profile.json: JSON file to be used as a seccomp fil‐
721 ter. Note that the io.podman.annotations.seccomp annotation is
722 set with the specified value as shown in podman inspect.
723
724 • proc-opts=OPTIONS : Comma-separated list of options to use for
725 the /proc mount. More details for the possible mount options
726 are specified in the proc(5) man page.
727
728 • unmask=ALL or /path/1:/path/2, or shell expanded paths
729 (/proc/*): Paths to unmask separated by a colon. If set to
730 ALL, it unmasks all the paths that are masked or made read-
731 only by default. The default masked paths are /proc/acpi,
732 /proc/kcore, /proc/keys, /proc/latency_stats, /proc/sched_de‐
733 bug, /proc/scsi, /proc/timer_list, /proc/timer_stats,
734 /sys/firmware, and /sys/fs/selinux, /sys/devices/virtual/pow‐
735 ercap. The default paths that are read-only are /proc/asound,
736 /proc/bus, /proc/fs, /proc/irq, /proc/sys, /proc/sysrq-trig‐
737 ger, /sys/fs/cgroup.
738
739
740
741 Note: Labeling can be disabled for all containers by setting la‐
742 bel=false in the containers.conf(5) file.
743
744
745 --share=namespace
746 A comma-separated list of kernel namespaces to share. If none or "" is
747 specified, no namespaces are shared, and the infra container is not
748 created unless explicitly specified via --infra=true. The namespaces to
749 choose from are cgroup, ipc, net, pid, uts. If the option is prefixed
750 with a "+", the namespace is appended to the default list. Otherwise,
751 it replaces the default list. Defaults match Kubernetes default (ipc,
752 net, uts)
753
754
755 --share-parent
756 This boolean determines whether or not all containers entering the pod
757 use the pod as their cgroup parent. The default value of this option is
758 true. Use the --share option to share the cgroup namespace rather than
759 a cgroup parent in a pod.
760
761
762 Note: This option conflicts with the --share=cgroup option since that
763 option sets the pod as the cgroup parent but enters the container into
764 the same cgroupNS as the infra container.
765
766
767 --shm-size=number[unit]
768 Size of /dev/shm. A unit can be b (bytes), k (kibibytes), m
769 (mebibytes), or g (gibibytes). If the unit is omitted, the system uses
770 bytes. If the size is omitted, the default is 64m. When size is 0,
771 there is no limit on the amount of memory used for IPC by the pod.
772 This option conflicts with --ipc=host.
773
774
775 --shm-size-systemd=number[unit]
776 Size of systemd-specific tmpfs mounts such as /run, /run/lock,
777 /var/log/journal and /tmp. A unit can be b (bytes), k (kibibytes), m
778 (mebibytes), or g (gibibytes). If the unit is omitted, the system uses
779 bytes. If the size is omitted, the default is 64m. When size is 0, the
780 usage is limited to 50% of the host's available memory.
781
782
783 --subgidname=name
784 Run the container in a new user namespace using the map with name in
785 the /etc/subgid file. If running rootless, the user needs to have the
786 right to use the mapping. See subgid(5). This flag conflicts with
787 --userns and --gidmap.
788
789
790 --subuidname=name
791 Run the container in a new user namespace using the map with name in
792 the /etc/subuid file. If running rootless, the user needs to have the
793 right to use the mapping. See subuid(5). This flag conflicts with
794 --userns and --uidmap.
795
796
797 --sysctl=name=value
798 Configure namespaced kernel parameters for all containers in the pod.
799
800
801 For the IPC namespace, the following sysctls are allowed:
802
803
804 • kernel.msgmax
805
806 • kernel.msgmnb
807
808 • kernel.msgmni
809
810 • kernel.sem
811
812 • kernel.shmall
813
814 • kernel.shmmax
815
816 • kernel.shmmni
817
818 • kernel.shm_rmid_forced
819
820 • Sysctls beginning with fs.mqueue.*
821
822
823
824 Note: if the ipc namespace is not shared within the pod, the above
825 sysctls are not allowed.
826
827
828 For the network namespace, only sysctls beginning with net.* are al‐
829 lowed.
830
831
832 Note: if the network namespace is not shared within the pod, the above
833 sysctls are not allowed.
834
835
836 --uidmap=container_uid:from_uid:amount
837 Run all containers in the pod in a new user namespace using the sup‐
838 plied mapping. This option conflicts with the --userns and --subuidname
839 options. This option provides a way to map host UIDs to container UIDs.
840 It can be passed several times to map different ranges.
841
842
843 --userns=mode
844 Set the user namespace mode for all the containers in a pod. It de‐
845 faults to the PODMAN_USERNS environment variable. An empty value ("")
846 means user namespaces are disabled.
847
848
849 Rootless user --userns=Key mappings:
850
851
852 ┌────────┬───────────┬─────────────────────┐
853 │Key │ Host User │ Container User │
854 ├────────┼───────────┼─────────────────────┤
855 │"" │ $UID │ 0 (Default User ac‐ │
856 │ │ │ count mapped to │
857 │ │ │ root user in con‐ │
858 │ │ │ tainer.) │
859 ├────────┼───────────┼─────────────────────┤
860 │keep-id │ $UID │ $UID (Map user ac‐ │
861 │ │ │ count to same UID │
862 │ │ │ within container.) │
863 ├────────┼───────────┼─────────────────────┤
864 │auto │ $UID │ nil (Host User UID │
865 │ │ │ is not mapped into │
866 │ │ │ container.) │
867 ├────────┼───────────┼─────────────────────┤
868 │nomap │ $UID │ nil (Host User UID │
869 │ │ │ is not mapped into │
870 │ │ │ container.) │
871 └────────┴───────────┴─────────────────────┘
872
873 Valid mode values are:
874
875
876 • auto[:OPTIONS,...]: automatically create a namespace. It is
877 possible to specify these options to auto:
878
879 • gidmapping=CONTAINER_GID:HOST_GID:SIZE to force a GID mapping
880 to be present in the user namespace.
881
882 • size=SIZE: to specify an explicit size for the automatic user
883 namespace. e.g. --userns=auto:size=8192. If size is not speci‐
884 fied, auto estimates the size for the user namespace.
885
886 • uidmapping=CONTAINER_UID:HOST_UID:SIZE to force a UID mapping
887 to be present in the user namespace.
888
889 • host: run in the user namespace of the caller. The processes
890 running in the container have the same privileges on the host
891 as any other process launched by the calling user (default).
892
893 • keep-id: creates a user namespace where the current rootless
894 user's UID:GID are mapped to the same values in the container.
895 This option is not allowed for containers created by the root
896 user.
897
898 • nomap: creates a user namespace where the current rootless
899 user's UID:GID are not mapped into the container. This option
900 is not allowed for containers created by the root user.
901
902
903
904 --uts=mode
905 Set the UTS namespace mode for the pod. The following values are sup‐
906 ported:
907
908
909 • host: use the host's UTS namespace inside the pod.
910
911 • private: create a new namespace for the pod (default).
912
913 • ns:[path]: run the pod in the given existing UTS namespace.
914
915
916
917 --volume, -v=[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]
918 Create a bind mount. If -v /HOST-DIR:/CONTAINER-DIR is specified, Pod‐
919 man bind mounts /HOST-DIR from the host into /CONTAINER-DIR in the Pod‐
920 man container. Similarly, -v SOURCE-VOLUME:/CONTAINER-DIR mounts the
921 named volume from the host into the container. If no such named volume
922 exists, Podman creates one. If no source is given, the volume is cre‐
923 ated as an anonymously named volume with a randomly generated name, and
924 is removed when the pod is removed via the --rm flag or the podman rm
925 --volumes command.
926
927
928 (Note when using the remote client, including Mac and Windows (exclud‐
929 ing WSL2) machines, the volumes are mounted from the remote server, not
930 necessarily the client machine.)
931
932
933 The OPTIONS is a comma-separated list and can be: [1] ⟨#Footnote1⟩
934
935
936 • rw|ro
937
938 • z|Z
939
940 • [O]
941
942 • [U]
943
944 • [no]copy
945
946 • [no]dev
947
948 • [no]exec
949
950 • [no]suid
951
952 • [r]bind
953
954 • [r]shared|[r]slave|[r]private[r]unbindable
955
956 • idmap[=options]
957
958
959
960 The CONTAINER-DIR must be an absolute path such as /src/docs. The vol‐
961 ume is mounted into the container at this directory.
962
963
964 If a volume source is specified, it must be a path on the host or the
965 name of a named volume. Host paths are allowed to be absolute or rela‐
966 tive; relative paths are resolved relative to the directory Podman is
967 run in. If the source does not exist, Podman returns an error. Users
968 must pre-create the source files or directories.
969
970
971 Any source that does not begin with a . or / is treated as the name of
972 a named volume. If a volume with that name does not exist, it is cre‐
973 ated. Volumes created with names are not anonymous, and they are not
974 removed by the --rm option and the podman rm --volumes command.
975
976
977 Specify multiple -v options to mount one or more volumes into a pod.
978
979
980 Write Protected Volume Mounts
981
982
983 Add :ro or :rw option to mount a volume in read-only or read-write
984 mode, respectively. By default, the volumes are mounted read-write.
985 See examples.
986
987
988 Chowning Volume Mounts
989
990
991 By default, Podman does not change the owner and group of source volume
992 directories mounted into containers. If a pod is created in a new user
993 namespace, the UID and GID in the container may correspond to another
994 UID and GID on the host.
995
996
997 The :U suffix tells Podman to use the correct host UID and GID based on
998 the UID and GID within the pod, to change recursively the owner and
999 group of the source volume. Chowning walks the file system under the
1000 volume and changes the UID/GID on each file. If the volume has thou‐
1001 sands of inodes, this process takes a long time, delaying the start of
1002 the pod.
1003
1004
1005 Warning use with caution since this modifies the host filesystem.
1006
1007
1008 Labeling Volume Mounts
1009
1010
1011 Labeling systems like SELinux require that proper labels are placed on
1012 volume content mounted into a pod. Without a label, the security system
1013 might prevent the processes running inside the pod from using the con‐
1014 tent. By default, Podman does not change the labels set by the OS.
1015
1016
1017 To change a label in the pod context, add either of two suffixes :z or
1018 :Z to the volume mount. These suffixes tell Podman to relabel file ob‐
1019 jects on the shared volumes. The z option tells Podman that two or more
1020 pods share the volume content. As a result, Podman labels the content
1021 with a shared content label. Shared volume labels allow all containers
1022 to read/write content. The Z option tells Podman to label the content
1023 with a private unshared label Only the current pod can use a private
1024 volume. Relabeling walks the file system under the volume and changes
1025 the label on each file, if the volume has thousands of inodes, this
1026 process takes a long time, delaying the start of the pod. If the volume
1027 was previously relabeled with the z option, Podman is optimized to not
1028 relabel a second time. If files are moved into the volume, then the la‐
1029 bels can be manually change with the chcon -Rt container_file_t PATH
1030 command.
1031
1032
1033 Note: Do not relabel system files and directories. Relabeling system
1034 content might cause other confined services on the machine to fail.
1035 For these types of containers we recommend disabling SELinux separa‐
1036 tion. The option --security-opt label=disable disables SELinux separa‐
1037 tion for the pod. For example if a user wanted to volume mount their
1038 entire home directory into a pod, they need to disable SELinux separa‐
1039 tion.
1040
1041 $ podman pod create --security-opt label=disable -v $HOME:/home/user fedora touch /home/user/file
1042
1043
1044
1045 Overlay Volume Mounts
1046
1047
1048 The :O flag tells Podman to mount the directory from the host as a tem‐
1049 porary storage using the overlay file system. The pod processes can
1050 modify content within the mountpoint which is stored in the container
1051 storage in a separate directory. In overlay terms, the source directory
1052 is the lower, and the container storage directory is the upper. Modifi‐
1053 cations to the mount point are destroyed when the pod finishes execut‐
1054 ing, similar to a tmpfs mount point being unmounted.
1055
1056
1057 For advanced users, the overlay option also supports custom non-
1058 volatile upperdir and workdir for the overlay mount. Custom upperdir
1059 and workdir can be fully managed by the users themselves, and Podman
1060 does not remove it on lifecycle completion. Example :O,up‐
1061 perdir=/some/upper,workdir=/some/work
1062
1063
1064 Subsequent executions of the container sees the original source direc‐
1065 tory content, any changes from previous pod executions no longer exist.
1066
1067
1068 One use case of the overlay mount is sharing the package cache from the
1069 host into the container to allow speeding up builds.
1070
1071
1072 Note: The O flag conflicts with other options listed above.
1073
1074
1075 Content mounted into the container is labeled with the private label.
1076 On SELinux systems, labels in the source directory must be read‐
1077 able by the pod infra container label. Usually containers can read/exe‐
1078 cute container_share_t and can read/write container_file_t. If unable
1079 to change the labels on a source volume, SELinux container separation
1080 must be disabled for the pod or infra container to work.
1081 - Do not modify the source directory mounted into the pod with an
1082 overlay mount, it can cause unexpected failures. Only modify the direc‐
1083 tory after the container finishes running.
1084
1085
1086 Mounts propagation
1087
1088
1089 By default bind mounted volumes are private. That means any mounts done
1090 inside the pod is not visible on host and vice versa. One can change
1091 this behavior by specifying a volume mount propagation property. Making
1092 a volume shared mounts done under that volume inside the pod is visible
1093 on host and vice versa. Making a volume slave enables only one way
1094 mount propagation and that is mounts done on host under that volume is
1095 visible inside container but not the other way around. [1] ⟨#Footnote1⟩
1096
1097
1098 To control mount propagation property of a volume one can use the
1099 [r]shared, [r]slave, [r]private or the [r]unbindable propagation flag.
1100 Propagation property can be specified only for bind mounted volumes and
1101 not for internal volumes or named volumes. For mount propagation to
1102 work the source mount point (the mount point where source dir is
1103 mounted on) has to have the right propagation properties. For shared
1104 volumes, the source mount point has to be shared. And for slave vol‐
1105 umes, the source mount point has to be either shared or slave. [1]
1106 ⟨#Footnote1⟩
1107
1108
1109 To recursively mount a volume and all of its submounts into a pod, use
1110 the rbind option. By default the bind option is used, and submounts of
1111 the source directory is not mounted into the pod.
1112
1113
1114 Mounting the volume with a copy option tells podman to copy content
1115 from the underlying destination directory onto newly created internal
1116 volumes. The copy only happens on the initial creation of the volume.
1117 Content is not copied up when the volume is subsequently used on dif‐
1118 ferent containers. The copy option is ignored on bind mounts and has no
1119 effect.
1120
1121
1122 Mounting volumes with the nosuid options means that SUID executables on
1123 the volume can not be used by applications to change their privilege.
1124 By default volumes are mounted with nosuid.
1125
1126
1127 Mounting the volume with the noexec option means that no executables on
1128 the volume can be executed within the pod.
1129
1130
1131 Mounting the volume with the nodev option means that no devices on the
1132 volume can be used by processes within the pod. By default volumes are
1133 mounted with nodev.
1134
1135
1136 If the HOST-DIR is a mount point, then dev, suid, and exec options are
1137 ignored by the kernel.
1138
1139
1140 Use df HOST-DIR to figure out the source mount, then use findmnt -o
1141 TARGET,PROPAGATION source-mount-dir to figure out propagation proper‐
1142 ties of source mount. If findmnt[4m(1) utility is not available, then one
1143 can look at the mount entry for the source mount point in
1144 /proc/self/mountinfo. Look at the "optional fields" and see if any
1145 propagation properties are specified. In there, shared:N means the
1146 mount is shared, master:N means mount is slave, and if nothing is
1147 there, the mount is private. [1] ⟨#Footnote1⟩
1148
1149
1150 To change propagation properties of a mount point, use mount(8) com‐
1151 mand. For example, if one wants to bind mount source directory /foo,
1152 one can do mount --bind /foo /foo and mount --make-private --make-
1153 shared /foo. This converts /foo into a shared mount point. Alterna‐
1154 tively, one can directly change propagation properties of source mount.
1155 Say / is source mount for /foo, then use mount --make-shared / to con‐
1156 vert / into a shared mount.
1157
1158
1159 Note: if the user only has access rights via a group, accessing the
1160 volume from inside a rootless pod fails.
1161
1162
1163 Idmapped mount
1164
1165
1166 If idmap is specified, create an idmapped mount to the target user
1167 namespace in the container. The idmap option supports a custom mapping
1168 that can be different than the user namespace used by the container.
1169 The mapping can be specified after the idmap option like:
1170 idmap=uids=0-1-10#10-11-10;gids=0-100-10. For each triplet, the first
1171 value is the start of the backing file system IDs that are mapped to
1172 the second value on the host. The length of this mapping is given in
1173 the third value. Multiple ranges are separated with #.
1174
1175
1176 --volumes-from=CONTAINER[:OPTIONS]
1177 Mount volumes from the specified container(s). Used to share volumes
1178 between containers and pods. The options is a comma-separated list with
1179 the following available elements:
1180
1181
1182 • rw|ro
1183
1184 • z
1185
1186
1187
1188 Mounts already mounted volumes from a source container onto another
1189 pod. CONTAINER may be a name or ID. To share a volume, use the --vol‐
1190 umes-from option when running the target container. Volumes can be
1191 shared even if the source container is not running.
1192
1193
1194 By default, Podman mounts the volumes in the same mode (read-write or
1195 read-only) as it is mounted in the source container. This can be
1196 changed by adding a ro or rw option.
1197
1198
1199 Labeling systems like SELinux require that proper labels are placed on
1200 volume content mounted into a pod. Without a label, the security system
1201 might prevent the processes running inside the container from using the
1202 content. By default, Podman does not change the labels set by the OS.
1203
1204
1205 To change a label in the pod context, add z to the volume mount. This
1206 suffix tells Podman to relabel file objects on the shared volumes. The
1207 z option tells Podman that two entities share the volume content. As a
1208 result, Podman labels the content with a shared content label. Shared
1209 volume labels allow all containers to read/write content.
1210
1211
1212 If the location of the volume from the source container overlaps with
1213 data residing on a target pod, then the volume hides that data on the
1214 target.
1215
1216
1218 $ podman pod create --name test
1219
1220 $ podman pod create mypod
1221
1222 $ podman pod create --infra=false
1223
1224 $ podman pod create --infra-command /top toppod
1225
1226 $ podman pod create --publish 8443:443
1227
1228 $ podman pod create --network slirp4netns:outbound_addr=127.0.0.1,allow_host_loopback=true
1229
1230 $ podman pod create --network slirp4netns:cidr=192.168.0.0/24
1231
1232 $ podman pod create --network pasta
1233
1234 $ podman pod create --network net1:ip=10.89.1.5 --network net2:ip=10.89.10.10
1235
1236
1237
1239 podman(1), podman-pod(1), podman-kube-play(1), containers.conf(1),
1240 cgroups(7)
1241
1242
1244 July 2018, Originally compiled by Peter Hunt pehunt@redhat.com
1245 ⟨mailto:pehunt@redhat.com⟩
1246
1247
1249 1: The Podman project is committed to inclusivity, a core value of open
1250 source. The master and slave mount propagation terminology used here is
1251 problematic and divisive, and needs to be changed. However, these terms
1252 are currently used within the Linux kernel and must be used as-is at
1253 this time. When the kernel maintainers rectify this usage, Podman will
1254 follow suit immediately.
1255
1256
1257
1258 podman-pod-create(1)