1podman-create(1)() podman-create(1)()
2
3
4
6 podman-create - Create a new container
7
8
10 podman create [options] image [command [arg ...]]
11
12
13 podman container create [options] image [command [arg ...]]
14
15
17 Creates a writable container layer over the specified image and pre‐
18 pares it for running the specified command. The container ID is then
19 printed to STDOUT. This is similar to podman run -d except the con‐
20 tainer is never started. You can then use the podman start container
21 command to start the container at any point.
22
23
24 The initial status of the container created with podman create is 'cre‐
25 ated'.
26
27
28 Default settings for flags are defined in containers.conf. Most set‐
29 tings for remote connections use the server's containers.conf, except
30 when documented in man pages.
31
32
34 The image is specified using transport:path format. If no transport is
35 specified, the docker (container registry) transport will be used by
36 default. For remote Podman, docker is the only allowed transport.
37
38
39 dir:path
40 An existing local directory path storing the manifest, layer tarballs
41 and signatures as individual files. This is a non-standardized format,
42 primarily useful for debugging or noninvasive container inspection.
43
44
45 $ podman save --format docker-dir fedora -o /tmp/fedora
46 $ podman create dir:/tmp/fedora echo hello
47
48
49
50 docker://docker-reference (Default)
51 An image reference stored in a remote container image registry. Ex‐
52 ample: "quay.io/podman/stable:latest". The reference can include a
53 path to a specific registry; if it does not, the registries listed in
54 registries.conf will be queried to find a matching image. By default,
55 credentials from podman login (stored at $XDG_RUNTIME_DIR/contain‐
56 ers/auth.json by default) will be used to authenticate; otherwise it
57 falls back to using credentials in $HOME/.docker/config.json.
58
59
60 $ podman create registry.fedoraproject.org/fedora:latest echo hello
61
62
63
64 docker-archive:path[:docker-reference] An image stored in the docker
65 save formatted file. docker-reference is only used when creating such a
66 file, and it must not contain a digest.
67
68
69 $ podman save --format docker-archive fedora -o /tmp/fedora
70 $ podman create docker-archive:/tmp/fedora echo hello
71
72
73
74 docker-daemon:docker-reference
75 An image in docker-reference format stored in the docker daemon in‐
76 ternal storage. The docker-reference can also be an image ID (docker-
77 daemon:algo:digest).
78
79
80 $ sudo docker pull fedora
81 $ sudo podman create docker-daemon:docker.io/library/fedora echo hello
82
83
84
85 oci-archive:path:tag
86 An image in a directory compliant with the "Open Container Image Lay‐
87 out Specification" at the specified path and specified with a tag.
88
89
90 $ podman save --format oci-archive fedora -o /tmp/fedora
91 $ podman create oci-archive:/tmp/fedora echo hello
92
93
94
96 --add-host=host
97 Add a custom host-to-IP mapping (host:ip)
98
99
100 Add a line to /etc/hosts. The format is hostname:ip. The --add-host op‐
101 tion can be set multiple times.
102
103
104 --annotation=key=value
105 Add an annotation to the container. The format is key=value. The --an‐
106 notation option can be set multiple times.
107
108
109 --arch=ARCH
110 Override the architecture, defaults to hosts, of the image to be
111 pulled. For example, arm.
112
113
114 --attach, -a=location
115 Attach to STDIN, STDOUT or STDERR.
116
117
118 In foreground mode (the default when -d is not specified), podman run
119 can start the process in the container and attach the console to the
120 process's standard input, output, and standard error. It can even pre‐
121 tend to be a TTY (this is what most command line executables expect)
122 and pass along signals. The -a option can be set for each of stdin,
123 stdout, and stderr.
124
125
126 --authfile=path
127 Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/contain‐
128 ers/auth.json
129
130
131 Note: You can also override the default path of the authentication file
132 by setting the REGISTRY_AUTH_FILE environment variable. export REG‐
133 ISTRY_AUTH_FILE=path
134
135
136 --blkio-weight=weight
137 Block IO weight (relative weight) accepts a weight value between 10 and
138 1000.
139
140
141 --blkio-weight-device=weight
142 Block IO weight (relative device weight, format: DEVICE_NAME:WEIGHT).
143
144
145 --cap-add=capability
146 Add Linux capabilities
147
148
149 --cap-drop=capability
150 Drop Linux capabilities
151
152
153 --cgroupns=mode
154 Set the cgroup namespace mode for the container.
155 host: use the host's cgroup namespace inside the container.
156 container:<NAME|ID>: join the namespace of the specified container.
157 ns:<PATH>: join the namespace at the specified path.
158 private: create a new cgroup namespace.
159
160
161 If the host uses cgroups v1, the default is set to host. On cgroups v2
162 the default is private.
163
164
165 --cgroups=mode
166 Determines whether the container will create CGroups. Valid values are
167 enabled, disabled, no-conmon, split, which the default being enabled.
168
169
170 The enabled option will create a new cgroup under the cgroup-parent.
171 The disabled option will force the container to not create CGroups, and
172 thus conflicts with CGroup options (--cgroupns and --cgroup-parent).
173 The no-conmon option disables a new CGroup only for the conmon process.
174 The split option splits the current cgroup in two sub-cgroups: one for
175 conmon and one for the container payload. It is not possible to set
176 --cgroup-parent with split.
177
178
179 --cgroup-parent=path
180 Path to cgroups under which the cgroup for the container will be cre‐
181 ated. If the path is not absolute, the path is considered to be rela‐
182 tive to the cgroups path of the init process. Cgroups will be created
183 if they do not already exist.
184
185
186 --cgroup-conf=KEY=VALUE
187 When running on cgroup v2, specify the cgroup file to write to and its
188 value. For example --cgroup-conf=memory.high=1073741824 sets the mem‐
189 ory.high limit to 1GB.
190
191
192 --cidfile=id
193 Write the container ID to the file
194
195
196 --conmon-pidfile=path
197 Write the pid of the conmon process to a file. conmon runs in a sepa‐
198 rate process than Podman, so this is necessary when using systemd to
199 restart Podman containers. (This option is not available with the re‐
200 mote Podman client)
201
202
203 --cpu-period=limit
204 Set the CPU period for the Completely Fair Scheduler (CFS), which is a
205 duration in microseconds. Once the container's CPU quota is used up, it
206 will not be scheduled to run until the current period ends. Defaults to
207 100000 microseconds.
208
209
210 On some systems, changing the CPU limits may not be allowed for non-
211 root users. For more details, see https://github.com/containers/pod‐
212 man/blob/master/troubleshooting.md#26-running-containers-with-cpu-lim‐
213 its-fails-with-a-permissions-error
214
215
216 --cpu-quota=limit
217 Limit the CPU Completely Fair Scheduler (CFS) quota.
218
219
220 Limit the container's CPU usage. By default, containers run with the
221 full CPU resource. The limit is a number in microseconds. If you pro‐
222 vide a number, the container will be allowed to use that much CPU time
223 until the CPU period ends (controllable via --cpu-period).
224
225
226 On some systems, changing the CPU limits may not be allowed for non-
227 root users. For more details, see https://github.com/containers/pod‐
228 man/blob/master/troubleshooting.md#26-running-containers-with-cpu-lim‐
229 its-fails-with-a-permissions-error
230
231
232 --cpu-rt-period=microseconds
233 Limit the CPU real-time period in microseconds
234
235
236 Limit the container's Real Time CPU usage. This flag tell the kernel to
237 restrict the container's Real Time CPU usage to the period you specify.
238
239
240 This flag is not supported on cgroups V2 systems.
241
242
243 --cpu-rt-runtime=microseconds
244 Limit the CPU real-time runtime in microseconds
245
246
247 Limit the containers Real Time CPU usage. This flag tells the kernel to
248 limit the amount of time in a given CPU period Real Time tasks may con‐
249 sume. Ex: Period of 1,000,000us and Runtime of 950,000us means that
250 this container could consume 95% of available CPU and leave the remain‐
251 ing 5% to normal priority tasks.
252
253
254 The sum of all runtimes across containers cannot exceed the amount al‐
255 lotted to the parent cgroup.
256
257
258 This flag is not supported on cgroups V2 systems.
259
260
261 --cpu-shares=shares
262 CPU shares (relative weight)
263
264
265 By default, all containers get the same proportion of CPU cycles. This
266 proportion can be modified by changing the container's CPU share
267 weighting relative to the weighting of all other running containers.
268
269
270 To modify the proportion from the default of 1024, use the --cpu-shares
271 flag to set the weighting to 2 or higher.
272
273
274 The proportion will only apply when CPU-intensive processes are run‐
275 ning. When tasks in one container are idle, other containers can use
276 the left-over CPU time. The actual amount of CPU time will vary depend‐
277 ing on the number of containers running on the system.
278
279
280 For example, consider three containers, one has a cpu-share of 1024 and
281 two others have a cpu-share setting of 512. When processes in all three
282 containers attempt to use 100% of CPU, the first container would re‐
283 ceive 50% of the total CPU time. If you add a fourth container with a
284 cpu-share of 1024, the first container only gets 33% of the CPU. The
285 remaining containers receive 16.5%, 16.5% and 33% of the CPU.
286
287
288 On a multi-core system, the shares of CPU time are distributed over all
289 CPU cores. Even if a container is limited to less than 100% of CPU
290 time, it can use 100% of each individual CPU core.
291
292
293 For example, consider a system with more than three cores. If you start
294 one container {C0} with -c=512 running one process, and another con‐
295 tainer {C1} with -c=1024 running two processes, this can result in the
296 following division of CPU shares:
297
298
299 PID container CPU CPU share 100 {C0} 0 100% of
300 CPU0 101 {C1} 1 100% of CPU1 102
301 {C1} 2 100% of CPU2
302
303
304 --cpus=number
305 Number of CPUs. The default is 0.0 which means no limit. This is short‐
306 hand for --cpu-period and --cpu-quota, so you may only set either
307
308
309 --cpus or --cpu-period and --cpu-quota.
310 On some systems, changing the CPU limits may not be allowed for non-
311 root users. For more details, see https://github.com/containers/pod‐
312 man/blob/master/troubleshooting.md#26-running-containers-with-cpu-lim‐
313 its-fails-with-a-permissions-error
314
315
316 --cpuset-cpus=cpus
317 CPUs in which to allow execution (0-3, 0,1)
318
319
320 --cpuset-mems=nodes
321 Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effec‐
322 tive on NUMA systems.
323
324
325 If you have four memory nodes on your system (0-3), use --cpuset-
326 mems=0,1 then processes in your container will only use memory from the
327 first two memory nodes.
328
329
330 --device=host-device[:container-device][:permissions]
331 Add a host device to the container. Optional permissions parameter can
332 be used to specify device permissions, it is combination of r for read,
333 w for write, and m for mknod(2).
334
335
336 Example: --device=/dev/sdc:/dev/xvdc:rwm.
337
338
339 Note: if _hostdevice is a symbolic link then it will be resolved first.
340 The container will only store the major and minor numbers of the host
341 device.
342
343
344 Note: if the user only has access rights via a group, accessing the de‐
345 vice from inside a rootless container will fail. Use the --group-add
346 keep-groups flag to pass the user's supplementary group access into the
347 container.
348
349
350 Podman may load kernel modules required for using the specified device.
351 The devices that podman will load modules when necessary are:
352 /dev/fuse.
353
354
355 --device-cgroup-rule="type major:minor mode"
356 Add a rule to the cgroup allowed devices list. The rule is expected to
357 be in the format specified in the Linux kernel documentation (Documen‐
358 tation/cgroup-v1/devices.txt):
359 - type: a (all), c (char), or b (block);
360 - major and minor: either a number, or * for all;
361 - mode: a composition of r (read), w (write), and m (mknod(2)).
362
363
364 --device-read-bps=path
365 Limit read rate (bytes per second) from a device (e.g. --device-read-
366 bps=/dev/sda:1mb)
367
368
369 --device-read-iops=path
370 Limit read rate (IO per second) from a device (e.g. --device-read-
371 iops=/dev/sda:1000)
372
373
374 --device-write-bps=path
375 Limit write rate (bytes per second) to a device (e.g. --device-write-
376 bps=/dev/sda:1mb)
377
378
379 --device-write-iops=path
380 Limit write rate (IO per second) to a device (e.g. --device-write-
381 iops=/dev/sda:1000)
382
383
384 --disable-content-trust
385 This is a Docker specific option to disable image verification to a
386 Docker registry and is not supported by Podman. This flag is a NOOP and
387 provided solely for scripting compatibility.
388
389
390 --dns=dns
391 Set custom DNS servers. Invalid if using --dns and --network that is
392 set to 'none' or container:<name|id>.
393
394
395 This option can be used to override the DNS configuration passed to the
396 container. Typically this is necessary when the host DNS configuration
397 is invalid for the container (e.g., 127.0.0.1). When this is the case
398 the --dns flags is necessary for every run.
399
400
401 The special value none can be specified to disable creation of /etc/re‐
402 solv.conf in the container by Podman. The /etc/resolv.conf file in the
403 image will be used without changes.
404
405
406 --dns-opt=option
407 Set custom DNS options. Invalid if using --dns-opt and --network that
408 is set to 'none' or container:<name|id>.
409
410
411 --dns-search=domain
412 Set custom DNS search domains. Invalid if using --dns-search and --net‐
413 work that is set to 'none' or container:<name|id>. (Use --dns-search=.
414 if you don't wish to set the search domain)
415
416
417 --entrypoint="command" | '["command", arg1 , ...]'
418 Overwrite the default ENTRYPOINT of the image
419
420
421 This option allows you to overwrite the default entrypoint of the im‐
422 age. The ENTRYPOINT of an image is similar to a COMMAND because it
423 specifies what executable to run when the container starts, but it is
424 (purposely) more difficult to override. The ENTRYPOINT gives a con‐
425 tainer its default nature or behavior, so that when you set an ENTRY‐
426 POINT you can run the container as if it were that binary, complete
427 with default options, and you can pass in more options via the COMMAND.
428 But, sometimes an operator may want to run something else inside the
429 container, so you can override the default ENTRYPOINT at runtime by us‐
430 ing a --entrypoint and a string to specify the new ENTRYPOINT.
431
432
433 You need to specify multi option commands in the form of a json string.
434
435
436 --env, -e=env
437 Set environment variables
438
439
440 This option allows arbitrary environment variables that are available
441 for the process to be launched inside of the container. If an environ‐
442 ment variable is specified without a value, Podman will check the host
443 environment for a value and set the variable only if it is set on the
444 host. If an environment variable ending in * is specified, Podman will
445 search the host environment for variables starting with the prefix and
446 will add those variables to the container. If an environment variable
447 with a trailing ***** is specified, then a value must be supplied.
448
449
450 See Environment ⟨#environment⟩ note below for precedence and examples.
451
452
453 --env-host=true|false
454 Use host environment inside of the container. See Environment note be‐
455 low for precedence. (This option is not available with the remote Pod‐
456 man client)
457
458
459 --env-file=file
460 Read in a line delimited file of environment variables. See Environment
461 note below for precedence.
462
463
464 --expose=port
465 Expose a port, or a range of ports (e.g. --expose=3300-3310) to set up
466 port redirection on the host system.
467
468
469 --gidmap=container_gid:host_gid:amount
470 GID map for the user namespace. Using this flag will run the container
471 with user namespace enabled. It conflicts with the --userns and --sub‐
472 gidname flags.
473
474
475 The following example maps uids 0-2000 in the container to the uids
476 30000-31999 on the host and gids 0-2000 in the container to the gids
477 30000-31999 on the host. --gidmap=0:30000:2000
478
479
480 --group-add=group|keep-groups
481 Add additional groups to assign to primary user running within the con‐
482 tainer process.
483
484
485 • keep-groups is a special flag that tells Podman to keep the
486 supplementary group access.
487
488
489
490 Allows container to use the user's supplementary group access. If file
491 systems or devices are only accessible by the rootless user's group,
492 this flag tells the OCI runtime to pass the group access into the con‐
493 tainer. Currently only available with the crun OCI runtime. Note: keep-
494 groups is exclusive, you cannot add any other groups with this flag.
495 (Not available for remote commands)
496
497
498 --health-cmd="command" | '["command", arg1 , ...]'
499 Set or alter a healthcheck command for a container. The command is a
500 command to be executed inside your container that determines your con‐
501 tainer health. The command is required for other healthcheck options to
502 be applied. A value of none disables existing healthchecks.
503
504
505 Multiple options can be passed in the form of a JSON array; otherwise,
506 the command will be interpreted as an argument to /bin/sh -c.
507
508
509 --health-interval=interval
510 Set an interval for the healthchecks (a value of disable results in no
511 automatic timer setup) (default "30s")
512
513
514 --health-retries=retries
515 The number of retries allowed before a healthcheck is considered to be
516 unhealthy. The default value is 3.
517
518
519 --health-start-period=period
520 The initialization time needed for a container to bootstrap. The value
521 can be expressed in time format like 2m3s. The default value is 0s
522
523
524 --health-timeout=timeout
525 The maximum time allowed to complete the healthcheck before an interval
526 is considered failed. Like start-period, the value can be expressed in
527 a time format such as 1m22s. The default value is 30s.
528
529
530 --hostname=name, -h
531 Container host name
532
533
534 Sets the container host name that is available inside the container.
535 Can only be used with a private UTS namespace --uts=private (default).
536 If --pod is specified and the pod shares the UTS namespace (default)
537 the pod's hostname will be used.
538
539
540 --help
541 Print usage statement
542
543
544 --http-proxy=true|false
545 By default proxy environment variables are passed into the container if
546 set for the Podman process. This can be disabled by setting the --http-
547 proxy option to false. The environment variables passed in include
548 http_proxy, https_proxy, ftp_proxy, no_proxy, and also the upper case
549 versions of those. This option is only needed when the host system must
550 use a proxy but the container should not use any proxy. Proxy environ‐
551 ment variables specified for the container in any other way will over‐
552 ride the values that would have been passed through from the host.
553 (Other ways to specify the proxy for the container include passing the
554 values with the --env flag, or hard coding the proxy environment at
555 container build time.) (This option is not available with the remote
556 Podman client)
557
558
559 For example, to disable passing these environment variables from host
560 to container:
561
562
563 --http-proxy=false
564
565
566 Defaults to true
567
568
569 --image-volume, builtin-volume=bind|tmpfs|ignore
570 Tells Podman how to handle the builtin image volumes. Default is bind.
571
572
573 • bind: An anonymous named volume will be created and mounted
574 into the container.
575
576 • tmpfs: The volume is mounted onto the container as a tmpfs,
577 which allows the users to create content that disappears when
578 the container is stopped.
579
580 • ignore: All volumes are just ignored and no action is taken.
581
582
583
584 --init
585 Run an init inside the container that forwards signals and reaps pro‐
586 cesses.
587
588
589 --init-ctr=type (pods only)
590 When using pods, create an init style container, which is run after the
591 infra container is started but before regular pod containers are
592 started. Init containers are useful for running setup operations for
593 the pod's applications.
594
595
596 Valid values for init-ctr type are always or once. The always value
597 means the container will run with each and every pod start, whereas the
598 once value means the container will only run once when the pod is
599 started and then the container is removed.
600
601
602 Init containers are only run on pod start. Restarting a pod will not
603 execute any init containers should they be present. Furthermore, init
604 containers can only be created in a pod when that pod is not running.
605
606
607 --init-path=path
608 Path to the container-init binary.
609
610
611 --interactive, -i=true|false
612 Keep STDIN open even if not attached. The default is false.
613
614
615 --ip6=ip
616 Not implemented
617
618
619 --ip=ip
620 Specify a static IP address for the container, for example
621 10.88.64.128. This option can only be used if the container is joined
622 to only a single network - i.e., --network=_network-name_ is used at
623 most once - and if the container is not joining another container's
624 network namespace via --network=container:_id_. The address must be
625 within the CNI network's IP address pool (default 10.88.0.0/16).
626
627
628 --ipc=ipc
629 Default is to create a private IPC namespace (POSIX SysV IPC) for the
630 container container:<name|id>: reuses another container
631 shared memory, semaphores and message queues host: use the
632 host shared memory,semaphores and message queues inside the container.
633 Note: the host mode gives the container full access to local shared
634 memory and is therefore considered insecure. ns:<path> path
635 to an IPC namespace to join.
636
637
638 --kernel-memory=number[unit]
639 Kernel memory limit (format: <number>[<unit>], where unit = b (bytes),
640 k (kilobytes), m (megabytes), or g (gigabytes))
641
642
643 Constrains the kernel memory available to a container. If a limit of 0
644 is specified (not using --kernel-memory), the container's kernel memory
645 is not limited. If you specify a limit, it may be rounded up to a mul‐
646 tiple of the operating system's page size and the value can be very
647 large, millions of trillions.
648
649
650 This flag is not supported on cgroups V2 systems.
651
652
653 --label, -l=label
654 Add metadata to a container (e.g., --label com.example.key=value)
655
656
657 --label-file=file
658 Read in a line delimited file of labels
659
660
661 --link-local-ip=ip
662 Not implemented
663
664
665 --log-driver="k8s-file"
666 Logging driver for the container. Currently available options are k8s-
667 file, journald, and none, with json-file aliased to k8s-file for
668 scripting compatibility.
669
670
671 --log-opt=name=value
672 Set custom logging configuration. The following *name*s are supported:
673
674
675 • path: specify a path to the log file (e.g. --log-opt
676 path=/var/log/container/mycontainer.json);
677
678 • max-size: specify a max size of the log file (e.g. --log-opt
679 max-size=10mb);
680
681 • tag: specify a custom log tag for the container (e.g. --log-
682 opt tag="{{.ImageName}}".
683
684
685
686 It supports the same keys as podman inspect --format.
687
688
689 This option is currently supported only by the journald log driver.
690
691
692 --log-opt tag="{{.ImageName}}"
693
694
695 It supports the same keys as podman inspect --format.
696
697
698 It is currently supported only by the journald log driver.
699
700
701 --mac-address=address
702 Container MAC address (e.g. 92:d0:c6:0a:29:33)
703
704
705 Remember that the MAC address in an Ethernet network must be unique.
706 The IPv6 link-local address will be based on the device's MAC address
707 according to RFC4862.
708
709
710 --memory, -m=limit
711 Memory limit (format: <number>[<unit>], where unit = b (bytes), k
712 (kilobytes), m (megabytes), or g (gigabytes))
713
714
715 Allows you to constrain the memory available to a container. If the
716 host supports swap memory, then the -m memory setting can be larger
717 than physical RAM. If a limit of 0 is specified (not using -m), the
718 container's memory is not limited. The actual limit may be rounded up
719 to a multiple of the operating system's page size (the value would be
720 very large, that's millions of trillions).
721
722
723 --memory-reservation=limit
724 Memory soft limit (format: <number>[<unit>], where unit = b (bytes), k
725 (kilobytes), m (megabytes), or g (gigabytes))
726
727
728 After setting memory reservation, when the system detects memory con‐
729 tention or low memory, containers are forced to restrict their consump‐
730 tion to their reservation. So you should always set the value below
731 --memory, otherwise the hard limit will take precedence. By default,
732 memory reservation will be the same as memory limit.
733
734
735 --memory-swap=limit
736 A limit value equal to memory plus swap. Must be used with the -m
737 (--memory) flag. The swap LIMIT should always be larger than -m (--mem‐
738 ory) value. By default, the swap LIMIT will be set to double the value
739 of --memory.
740
741
742 The format of LIMIT is <number>[<unit>]. Unit can be b (bytes), k
743 (kilobytes), m (megabytes), or g (gigabytes). If you don't specify a
744 unit, b is used. Set LIMIT to -1 to enable unlimited swap.
745
746
747 --memory-swappiness=number
748 Tune a container's memory swappiness behavior. Accepts an integer be‐
749 tween 0 and 100.
750
751
752 This flag is not supported on cgroups V2 systems.
753
754
755 --mount=type=TYPE,TYPE-SPECIFIC-OPTION[,...]
756 Attach a filesystem mount to the container
757
758
759 Current supported mount TYPEs are bind, volume, image, tmpfs and de‐
760 vpts. [1] ⟨#Footnote1⟩
761
762
763 e.g.
764
765 type=bind,source=/path/on/host,destination=/path/in/container
766
767 type=bind,src=/path/on/host,dst=/path/in/container,relabel=shared
768
769 type=volume,source=vol1,destination=/path/in/container,ro=true
770
771 type=tmpfs,tmpfs-size=512M,destination=/path/in/container
772
773 type=image,source=fedora,destination=/fedora-image,rw=true
774
775 type=devpts,destination=/dev/pts
776
777 Common Options:
778
779 · src, source: mount source spec for bind and volume. Mandatory for bind.
780
781 · dst, destination, target: mount destination spec.
782
783 Options specific to volume:
784
785 · ro, readonly: true or false (default).
786
787 Options specific to image:
788
789 · rw, readwrite: true or false (default).
790
791 Options specific to bind:
792
793 · ro, readonly: true or false (default).
794
795 · bind-propagation: shared, slave, private, unbindable, rshared, rslave, runbindable, or rprivate(default). See also mount(2).
796
797 . bind-nonrecursive: do not setup a recursive bind mount. By default it is recursive.
798
799 . relabel: shared, private.
800
801 Options specific to tmpfs:
802
803 · ro, readonly: true or false (default).
804
805 · tmpfs-size: Size of the tmpfs mount in bytes. Unlimited by default in Linux.
806
807 · tmpfs-mode: File mode of the tmpfs in octal. (e.g. 700 or 0700.) Defaults to 1777 in Linux.
808
809 · tmpcopyup: Enable copyup from the image directory at the same location to the tmpfs. Used by default.
810
811 · notmpcopyup: Disable copying files from the image to the tmpfs.
812
813
814
815 --name=name
816 Assign a name to the container
817
818
819 The operator can identify a container in three ways: UUID long identi‐
820 fier
821 (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”)
822 UUID short identifier (“f78375b1c487”) Name (“jonah”)
823
824
825 podman generates a UUID for each container, and if a name is not as‐
826 signed to the container with --name then it will generate a random
827 string name. The name is useful any place you need to identify a con‐
828 tainer. This works for both background and foreground containers.
829
830
831 --network=mode, --net
832 Set the network mode for the container. Invalid if using --dns, --dns-
833 opt, or --dns-search with --network that is set to none or con‐
834 tainer:id. If used together with --pod, the container will not join the
835 pod's network namespace.
836
837
838 Valid mode values are:
839
840
841 • bridge: Create a network stack on the default bridge. This is
842 the default for rootfull containers.
843
844 • none: Create a network namespace for the container but do not
845 configure network interfaces for it, thus the container has no
846 network connectivity.
847
848 • container:id: Reuse another container's network stack.
849
850 • host: Do not create a network namespace, the container will
851 use the host's network. Note: The host mode gives the con‐
852 tainer full access to local system services such as D-bus and
853 is therefore considered insecure.
854
855 • network: Connect to a user-defined network, multiple networks
856 should be comma-separated.
857
858 • ns:path: Path to a network namespace to join.
859
860 • private: Create a new namespace for the container. This will
861 use the bridge mode for rootfull containers and slirp4netns
862 for rootless ones.
863
864 • slirp4netns[:OPTIONS,...]: use slirp4netns(1) to create a user
865 network stack. This is the default for rootless containers. It
866 is possible to specify these additional options:
867
868 • allow_host_loopback=true|false: Allow the slirp4netns to
869 reach the host loopback IP (10.0.2.2, which is added to
870 /etc/hosts as host.containers.internal for your conve‐
871 nience). Default is false.
872
873 • mtu=MTU: Specify the MTU to use for this network. (Default
874 is 65520).
875
876 • cidr=CIDR: Specify ip range to use for this network. (De‐
877 fault is 10.0.2.0/24).
878
879 • enable_ipv6=true|false: Enable IPv6. Default is false. (Re‐
880 quired for outbound_addr6).
881
882 • outbound_addr=INTERFACE: Specify the outbound interface
883 slirp should bind to (ipv4 traffic only).
884
885 • outbound_addr=IPv4: Specify the outbound ipv4 address slirp
886 should bind to.
887
888 • outbound_addr6=INTERFACE: Specify the outbound interface
889 slirp should bind to (ipv6 traffic only).
890
891 • outbound_addr6=IPv6: Specify the outbound ipv6 address slirp
892 should bind to.
893
894 • port_handler=rootlesskit: Use rootlesskit for port forward‐
895 ing. Default. Note: Rootlesskit changes the source IP ad‐
896 dress of incoming packets to a IP address in the container
897 network namespace, usually 10.0.2.100. If your application
898 requires the real source IP address, e.g. web server logs,
899 use the slirp4netns port handler. The rootlesskit port han‐
900 dler is also used for rootless containers when connected to
901 user-defined networks.
902
903 • port_handler=slirp4netns: Use the slirp4netns port forward‐
904 ing, it is slower than rootlesskit but preserves the correct
905 source IP address. This port handler cannot be used for
906 user-defined networks.
907
908
909
910
911
912 --network-alias=alias
913 Add network-scoped alias for the container. NOTE: A container will
914 only have access to aliases on the first network that it joins. This is
915 a limitation that will be removed in a later release.
916
917
918 --no-healthcheck=true|false
919 Disable any defined healthchecks for container.
920
921
922 --no-hosts=true|false
923 Do not create /etc/hosts for the container. By default, Podman will
924 manage /etc/hosts, adding the container's own IP address and any hosts
925 from --add-host.
926
927
928 --no-hosts disables this, and the image's /etc/host will be preserved un‐
929 modified.
930 This option conflicts with --add-host.
931
932
933 --oom-kill-disable=true|false
934 Whether to disable OOM Killer for the container or not.
935
936
937 --oom-score-adj=num
938 Tune the host's OOM preferences for containers (accepts -1000 to 1000)
939
940
941 --os=OS
942 Override the OS, defaults to hosts, of the image to be pulled. For ex‐
943 ample, windows.
944
945
946 --personality=persona
947 Personality sets the execution domain via Linux personality(2).
948
949
950 --pid=pid
951 Set the PID mode for the container Default is to create a private PID
952 namespace for the container - container:<name|id>: join another con‐
953 tainer's PID namespace - host: use the host's PID namespace for the
954 container. Note: the host mode gives the container full access to local
955 PID and is therefore considered insecure. - ns: join the specified PID
956 namespace - private: create a new namespace for the container (default)
957
958
959 --pids-limit=limit
960 Tune the container's pids limit. Set -1 to have unlimited pids for the
961 container. (default "4096" on systems that support PIDS cgroups).
962
963
964 --platform=OS/ARCH
965 Specify the platform for selecting the image. (Conflicts with --arch
966 and --os) The --platform option can be used to override the current ar‐
967 chitecture and operating system.
968
969
970 --pod=name
971 Run container in an existing pod. If you want Podman to make the pod
972 for you, preference the pod name with new:. To make a pod with more
973 granular options, use the podman pod create command before creating a
974 container.
975
976
977 --pod-id-file=path
978 Run container in an existing pod and read the pod's ID from the speci‐
979 fied file. If a container is run within a pod, and the pod has an in‐
980 fra-container, the infra-container will be started before the container
981 is.
982
983
984 --privileged=true|false
985 Give extended privileges to this container. The default is false.
986
987
988 By default, Podman containers are “unprivileged” (=false) and cannot,
989 for example, modify parts of the operating system. This is because by
990 default a container is not allowed to access any devices. A “privi‐
991 leged” container is given access to all devices.
992
993
994 When the operator executes a privileged container, Podman enables ac‐
995 cess to all devices on the host, turns off graphdriver mount options,
996 as well as turning off most of the security measures protecting the
997 host from the container.
998
999
1000 Rootless containers cannot have more privileges than the account that
1001 launched them.
1002
1003
1004 --publish, -p=port
1005 Publish a container's port, or range of ports, to the host
1006
1007
1008 Format: ip:hostPort:containerPort | ip::containerPort | hostPort:con‐
1009 tainerPort | containerPort Both hostPort and containerPort can be spec‐
1010 ified as a range of ports. When specifying ranges for both, the number
1011 of container ports in the range must match the number of host ports in
1012 the range. (e.g., podman run -p 1234-1236:1222-1224 --name thisWorks
1013 -t busybox but not podman run -p 1230-1236:1230-1240 --name RangeCon‐
1014 tainerPortsBiggerThanRangeHostPorts -t busybox) With host IP: podman
1015 run -p 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage
1016 If host IP is set to 0.0.0.0 or not set at all, the port will be bound
1017 on all IPs on the host. Host port does not have to be specified (e.g.
1018 podman run -p 127.0.0.1::80). If it is not, the container port will be
1019 randomly assigned a port on the host. Use podman port to see the ac‐
1020 tual mapping: podman port CONTAINER $CONTAINERPORT
1021
1022
1023 Note: if a container will be run within a pod, it is not necessary to
1024 publish the port for the containers in the pod. The port must only be
1025 published by the pod itself. Pod network stacks act like the network
1026 stack on the host - you have a variety of containers in the pod, and
1027 programs in the container, all sharing a single interface and IP ad‐
1028 dress, and associated ports. If one container binds to a port, no other
1029 container can use that port within the pod while it is in use. Contain‐
1030 ers in the pod can also communicate over localhost by having one con‐
1031 tainer bind to localhost in the pod, and another connect to that port.
1032
1033
1034 --publish-all, -P=true|false
1035 Publish all exposed ports to random ports on the host interfaces. The
1036 default is false.
1037
1038
1039 When set to true publish all exposed ports to the host interfaces. The
1040 default is false. If the operator uses -P (or -p) then Podman will make
1041 the exposed port accessible on the host and the ports will be available
1042 to any client that can reach the host. When using -P, Podman will bind
1043 any exposed port to a random port on the host within an ephemeral port
1044 range defined by /proc/sys/net/ipv4/ip_local_port_range. To find the
1045 mapping between the host ports and the exposed ports, use podman port.
1046
1047
1048 --pull=missing
1049 Pull image before creating ("always"|"missing"|"never") (default "miss‐
1050 ing").
1051 'missing': default value, attempt to pull the latest image from
1052 the registries listed in registries.conf if a local image does not ex‐
1053 ist.Raise an error if the image is not in any listed registry and is
1054 not present locally.
1055 'always': Pull the image from the first registry it is found in
1056 as listed in registries.conf. Raise an error if not found in the reg‐
1057 istries, even if the image is present locally.
1058 'never': do not pull the image from the registry, use only the
1059 local version. Raise an error if the image is not present locally.
1060
1061
1062 Defaults to missing.
1063
1064
1065 --quiet, -q
1066 Suppress output information when pulling images
1067
1068
1069 --read-only=true|false
1070 Mount the container's root filesystem as read only.
1071
1072
1073 By default a container will have its root filesystem writable allowing
1074 processes to write files anywhere. By specifying the --read-only flag
1075 the container will have its root filesystem mounted as read only pro‐
1076 hibiting any writes.
1077
1078
1079 --read-only-tmpfs=true|false
1080 If container is running in --read-only mode, then mount a read-write
1081 tmpfs on /run, /tmp, and /var/tmp. The default is true
1082
1083
1084 --replace=true|false
1085 If another container with the same name already exists, replace and re‐
1086 move it. The default is false.
1087
1088
1089 --requires=container
1090 Specify one or more requirements. A requirement is a dependency con‐
1091 tainer that will be started before this container. Containers can be
1092 specified by name or ID, with multiple containers being separated by
1093 commas.
1094
1095
1096 --restart=policy
1097 Restart policy to follow when containers exit. Restart policy will not
1098 take effect if a container is stopped via the podman kill or podman
1099 stop commands.
1100
1101
1102 Valid values are:
1103
1104
1105 • no : Do not restart containers on exit
1106
1107 • on-failure[:max_retries] : Restart containers when they exit
1108 with a non-0 exit code, retrying indefinitely or until the op‐
1109 tional max_retries count is hit
1110
1111 • always : Restart containers when they exit,
1112 regardless of status, retrying indefinitely
1113
1114 • unless-stopped : Identical to always
1115
1116
1117
1118 Please note that restart will not restart containers after a system re‐
1119 boot. If this functionality is required in your environment, you can
1120 invoke Podman from a systemd unit file, or create an init script for
1121 whichever init system is in use. To generate systemd unit files,
1122 please see podman generate systemd
1123
1124
1125 --rm=true|false
1126 Automatically remove the container when it exits. The default is false.
1127
1128
1129 --rootfs
1130 If specified, the first argument refers to an exploded container on the
1131 file system.
1132
1133
1134 This is useful to run a container without requiring any image manage‐
1135 ment, the rootfs of the container is assumed to be managed externally.
1136
1137
1138 --sdnotify=container|conmon|ignore
1139 Determines how to use the NOTIFY_SOCKET, as passed with systemd and
1140 Type=notify.
1141
1142
1143 Default is container, which means allow the OCI runtime to proxy the
1144 socket into the container to receive ready notification. Podman will
1145 set the MAINPID to conmon's pid. The conmon option sets MAINPID to
1146 conmon's pid, and sends READY when the container has started. The
1147 socket is never passed to the runtime or the container. The ignore op‐
1148 tion removes NOTIFY_SOCKET from the environment for itself and child
1149 processes, for the case where some other process above Podman uses NO‐
1150 TIFY_SOCKET and Podman should not use it.
1151
1152
1153 --seccomp-policy=policy
1154 Specify the policy to select the seccomp profile. If set to image, Pod‐
1155 man will look for a "io.containers.seccomp.profile" label in the con‐
1156 tainer-image config and use its value as a seccomp profile. Otherwise,
1157 Podman will follow the default policy by applying the default profile
1158 unless specified otherwise via --security-opt seccomp as described be‐
1159 low.
1160
1161
1162 Note that this feature is experimental and may change in the future.
1163
1164
1165 --secret=secret[,opt=opt ...]
1166 Give the container access to a secret. Can be specified multiple times.
1167
1168
1169 A secret is a blob of sensitive data which a container needs at runtime
1170 but should not be stored in the image or in source control, such as
1171 usernames and passwords, TLS certificates and keys, SSH keys or other
1172 important generic strings or binary content (up to 500 kb in size).
1173
1174
1175 When secrets are specified as type mount, the secrets are copied and
1176 mounted into the container when a container is created. When secrets
1177 are specified as type env, the secret will be set as an environment
1178 variable within the container. Secrets are written in the container at
1179 the time of container creation, and modifying the secret using podman
1180 secret commands after the container is created will not affect the se‐
1181 cret inside the container.
1182
1183
1184 Secrets and its storage are managed using the podman secret command.
1185
1186
1187 Secret Options
1188
1189
1190 • type=mount|env : How the secret will be exposed to the con‐
1191 tainer. Default mount.
1192
1193 • target=target : Target of secret. Defaults to secret name.
1194
1195 • uid=0 : UID of secret. Defaults to 0. Mount secret
1196 type only.
1197
1198 • gid=0 : GID of secret. Defaults to 0. Mount secret
1199 type only.
1200
1201 • mode=0 : Mode of secret. Defaults to 0444. Mount
1202 secret type only.
1203
1204
1205
1206 --security-opt=option
1207 Security Options
1208
1209
1210 • apparmor=unconfined : Turn off apparmor confinement for the
1211 container
1212
1213 • apparmor=your-profile : Set the apparmor confinement profile
1214 for the container
1215
1216 • label=user:USER : Set the label user for the container
1217 processes
1218
1219 • label=role:ROLE : Set the label role for the container
1220 processes
1221
1222 • label=type:TYPE : Set the label process type for the con‐
1223 tainer processes
1224
1225 • label=level:LEVEL : Set the label level for the container
1226 processes
1227
1228 • label=filetype:TYPE : Set the label file type for the con‐
1229 tainer files
1230
1231 • label=disable : Turn off label separation for the con‐
1232 tainer
1233
1234
1235
1236 Note: Labeling can be disabled for all containers by setting la‐
1237 bel=false in the containers.conf (/etc/containers/containers.conf or
1238 $HOME/.config/containers/containers.conf) file.
1239
1240
1241 • mask=/path/1:/path/2 : The paths to mask separated by a colon.
1242 A masked path cannot be accessed inside the container.
1243
1244 • no-new-privileges : Disable container processes from gaining
1245 additional privileges
1246
1247 • seccomp=unconfined : Turn off seccomp confinement for the con‐
1248 tainer
1249
1250 • seccomp=profile.json : White listed syscalls seccomp Json
1251 file to be used as a seccomp filter
1252
1253 • proc-opts=OPTIONS : Comma-separated list of options to use for
1254 the /proc mount. More details for the possible mount options
1255 are specified in the proc(5) man page.
1256
1257 • unmask=ALL or /path/1:/path/2, or shell expanded paths
1258 (/proc/*): Paths to unmask separated by a colon. If set to
1259 ALL, it will unmask all the paths that are masked or made read
1260 only by default. The default masked paths are /proc/acpi,
1261 /proc/kcore, /proc/keys, /proc/latency_stats, /proc/sched_de‐
1262 bug, /proc/scsi, /proc/timer_list, /proc/timer_stats,
1263 /sys/firmware, and /sys/fs/selinux. The default paths that
1264 are read only are /proc/asound, /proc/bus, /proc/fs,
1265 /proc/irq, /proc/sys, /proc/sysrq-trigger, /sys/fs/cgroup.
1266
1267
1268
1269 Note: Labeling can be disabled for all containers by setting la‐
1270 bel=false in the containers.conf (/etc/containers/containers.conf or
1271 $HOME/.config/containers/containers.conf) file.
1272
1273
1274 --shm-size=size
1275 Size of /dev/shm (format: <number>[<unit>], where unit = b (bytes), k
1276 (kilobytes), m (megabytes), or g (gigabytes)) If you omit the unit, the
1277 system uses bytes. If you omit the size entirely, the system uses 64m.
1278 When size is 0, there is no limit on the amount of memory used for IPC
1279 by the container.
1280
1281
1282 --stop-signal=SIGTERM
1283 Signal to stop a container. Default is SIGTERM.
1284
1285
1286 --stop-timeout=seconds
1287 Timeout (in seconds) to stop a container. Default is 10. Remote con‐
1288 nections use local containers.conf for defaults
1289
1290
1291 --subgidname=name
1292 Name for GID map from the /etc/subgid file. Using this flag will run
1293 the container with user namespace enabled. This flag conflicts with
1294 --userns and --gidmap.
1295
1296
1297 --subuidname=name
1298 Name for UID map from the /etc/subuid file. Using this flag will run
1299 the container with user namespace enabled. This flag conflicts with
1300 --userns and --uidmap.
1301
1302
1303 --sysctl=SYSCTL
1304 Configure namespaced kernel parameters at runtime
1305
1306
1307 IPC Namespace - current sysctls allowed:
1308
1309
1310 kernel.msgmax, kernel.msgmnb, kernel.msgmni, kernel.sem, kernel.shmall,
1311 kernel.shmmax, kernel.shmmni, kernel.shm_rmid_forced Sysctls beginning
1312 with fs.mqueue.*
1313
1314
1315 Note: if you use the --ipc=host option these sysctls will not be al‐
1316 lowed.
1317
1318
1319 Network Namespace - current sysctls allowed:
1320 Sysctls beginning with net.*
1321
1322
1323 Note: if you use the --network=host option these sysctls will not be
1324 allowed.
1325
1326
1327 --systemd=true|false|always
1328 Run container in systemd mode. The default is true.
1329
1330
1331 The value always enforces the systemd mode is enforced without looking
1332 at the executable name. Otherwise, if set to true and the command you
1333 are running inside the container is systemd, /usr/sbin/init, /sbin/init
1334 or /usr/local/sbin/init.
1335
1336
1337 If the command you are running inside of the container is systemd, Pod‐
1338 man will setup tmpfs mount points in the following directories:
1339
1340
1341 /run, /run/lock, /tmp, /sys/fs/cgroup/systemd, /var/lib/journal
1342
1343
1344 It will also set the default stop signal to SIGRTMIN+3.
1345
1346
1347 This allow systemd to run in a confined container without any modifica‐
1348 tions.
1349
1350
1351 Note: On SELinux systems, systemd attempts to write to the cgroup file
1352 system. Containers writing to the cgroup file system are denied by de‐
1353 fault. The container_manage_cgroup boolean must be enabled for this to
1354 be allowed on an SELinux separated system.
1355
1356
1357 setsebool -P container_manage_cgroup true
1358
1359
1360 --timeout=seconds
1361 Maximum time a container is allowed to run before conmon sends it the
1362 kill signal. By default containers will run until they exit or are
1363 stopped by podman stop.
1364
1365
1366 --tls-verify=true|false
1367 Require HTTPS and verify certificates when contacting registries (de‐
1368 fault: true). If explicitly set to true, then TLS verification will be
1369 used. If set to false, then TLS verification will not be used. If not
1370 specified, TLS verification will be used unless the target registry is
1371 listed as an insecure registry in registries.conf.
1372
1373
1374 --tmpfs=fs
1375 Create a tmpfs mount
1376
1377
1378 Mount a temporary filesystem (tmpfs) mount into a container, for exam‐
1379 ple:
1380
1381
1382 $ podman create -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image
1383
1384
1385 This command mounts a tmpfs at /tmp within the container. The supported
1386 mount options are the same as the Linux default mount flags. If you do
1387 not specify any options, the systems uses the following options:
1388 rw,noexec,nosuid,nodev.
1389
1390
1391 --tty, -t=true|false
1392 Allocate a pseudo-TTY. The default is false.
1393
1394
1395 When set to true Podman will allocate a pseudo-tty and attach to the
1396 standard input of the container. This can be used, for example, to run
1397 a throwaway interactive shell. The default is false.
1398
1399
1400 Note: The -t option is incompatible with a redirection of the Podman
1401 client standard input.
1402
1403
1404 --tz=timezone
1405 Set timezone in container. This flag takes area-based timezones, GMT
1406 time, as well as local, which sets the timezone in the container to
1407 match the host machine. See /usr/share/zoneinfo/ for valid timezones.
1408 Remote connections use local containers.conf for defaults
1409
1410
1411 --umask=umask
1412 Set the umask inside the container. Defaults to 0022. Remote connec‐
1413 tions use local containers.conf for defaults
1414
1415
1416 --uidmap=container_uid:from_uid:amount
1417 Run the container in a new user namespace using the supplied mapping.
1418 This option conflicts with the --userns and --subuidname options. This
1419 option provides a way to map host UIDs to container UIDs. It can be
1420 passed several times to map different ranges.
1421
1422
1423 The _fromuid value is based upon the user running the command, either
1424 rootfull or rootless users. * rootfull user: con‐
1425 tainer_uid:host_uid:amount * rootless user: container_uid:intermedi‐
1426 ate_uid:amount
1427
1428
1429 When podman create is called by a privileged user, the option --uidmap
1430 works as a direct mapping between host UIDs and container UIDs.
1431
1432
1433 host UID -> container UID
1434
1435
1436 The amount specifies the number of consecutive UIDs that will be
1437 mapped. If for example amount is 4 the mapping would look like:
1438
1439
1440 | host UID | container UID | | - | -
1441 | | _fromuid | _containeruid | | _fromuid + 1 | _containeruid +
1442 1 | | _fromuid + 2 | _containeruid + 2 | | _fromuid + 3 | _containeruid
1443 + 3 |
1444
1445
1446 When podman create is called by an unprivileged user (i.e. running
1447 rootless), the value _fromuid is interpreted as an "intermediate UID".
1448 In the rootless case, host UIDs are not mapped directly to container
1449 UIDs. Instead the mapping happens over two mapping steps:
1450
1451
1452 host UID -> intermediate UID -> container UID
1453
1454
1455 The --uidmap option only influences the second mapping step.
1456
1457
1458 The first mapping step is derived by Podman from the contents of the
1459 file /etc/subuid and the UID of the user calling Podman.
1460
1461
1462 First mapping step:
1463
1464
1465 | host UID | intermediate UID |
1466 | - | - |
1467 | UID for the user starting Podman | 0 |
1468 | 1st subordinate UID for the user starting Podman | 1 |
1469 | 2nd subordinate UID for the user starting Podman | 2 |
1470 | 3rd subordinate UID for the user starting Podman | 3 |
1471 | nth subordinate UID for the user starting Podman | n |
1472
1473
1474 To be able to use intermediate UIDs greater than zero, the user needs
1475 to have subordinate UIDs configured in /etc/subuid. See subuid(5).
1476
1477
1478 The second mapping step is configured with --uidmap.
1479
1480
1481 If for example amount is 5 the second mapping step would look like:
1482
1483
1484 | intermediate UID | container UID | | - |
1485 - | | _fromuid | _containeruid | |
1486 _fromuid + 1 | _containeruid + 1 | | _fromuid + 2 | _con‐
1487 taineruid + 2 | | _fromuid + 3 | _containeruid + 3 | | _fromuid +
1488 4 | _containeruid + 4 |
1489
1490
1491 Even if a user does not have any subordinate UIDs in /etc/subuid,
1492 --uidmap could still be used to map the normal UID of the user to a
1493 container UID by running podman create --uidmap $container_uid:0:1
1494 --user $container_uid ....
1495
1496
1497 --ulimit=option
1498 Ulimit options
1499
1500
1501 You can pass host to copy the current configuration from the host.
1502
1503
1504 --user, -u=user
1505 Sets the username or UID used and optionally the groupname or GID for
1506 the specified command.
1507
1508
1509 The following examples are all valid: --user [user | user:group | uid |
1510 uid:gid | user:gid | uid:group ]
1511
1512
1513 Without this argument the command will be run as root in the container.
1514
1515
1516 --userns=mode
1517 Set the user namespace mode for the container. It defaults to the POD‐
1518 MAN_USERNS environment variable. An empty value ("") means user name‐
1519 spaces are disabled unless an explicit mapping is set with the --uidmap
1520 and --gidmap options.
1521
1522
1523 Valid mode values are:
1524
1525
1526 auto[:OPTIONS,...]: automatically create a unique user namespace.
1527
1528
1529 The --userns=auto flag, requires that the user name containers and a
1530 range of subordinate user ids that the Podman container is allowed to
1531 use be specified in the /etc/subuid and /etc/subgid files.
1532
1533
1534 Example: containers:2147483647:2147483648.
1535
1536
1537 Podman allocates unique ranges of UIDs and GIDs from the containers
1538 subpordinate user ids. The size of the ranges is based on the number of
1539 UIDs required in the image. The number of UIDs and GIDs can be overrid‐
1540 den with the size option. The auto options currently does not work in
1541 rootless mode
1542
1543
1544 Valid auto options:
1545
1546
1547 • gidmapping=_CONTAINER_GID:HOSTGID:SIZE: to force a GID mapping
1548 to be present in the user namespace.
1549
1550 • size=SIZE: to specify an explicit size for the automatic user
1551 namespace. e.g. --userns=auto:size=8192. If size is not speci‐
1552 fied, auto will estimate a size for the user namespace.
1553
1554 • uidmapping=_CONTAINER_UID:HOSTUID:SIZE: to force a UID mapping
1555 to be present in the user namespace.
1556
1557
1558
1559 container:id: join the user namespace of the specified container.
1560
1561
1562 host: run in the user namespace of the caller. The processes running in
1563 the container will have the same privileges on the host as any other
1564 process launched by the calling user (default).
1565
1566
1567 keep-id: creates a user namespace where the current rootless user's
1568 UID:GID are mapped to the same values in the container. This option is
1569 ignored for containers created by the root user.
1570
1571
1572 ns:namespace: run the container in the given existing user namespace.
1573
1574
1575 private: create a new namespace for the container.
1576
1577
1578 This option is incompatible with --gidmap, --uidmap, --subuidname and
1579 --subgidname.
1580
1581
1582 --uts=mode
1583 Set the UTS namespace mode for the container. The following values are
1584 supported:
1585
1586
1587 • host: use the host's UTS namespace inside the container.
1588
1589 • private: create a new namespace for the container (default).
1590
1591 • ns:[path]: run the container in the given existing UTS name‐
1592 space.
1593
1594 • container:[container]: join the UTS namespace of the specified
1595 container.
1596
1597
1598
1599 --variant=VARIANT
1600 Use VARIANT instead of the default architecture variant of the con‐
1601 tainer image. Some images can use multiple variants of the arm archi‐
1602 tectures, such as arm/v5 and arm/v7.
1603
1604
1605 --volume, -v[=[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]]
1606 Create a bind mount. If you specify, -v /HOST-DIR:/CONTAINER-DIR, Pod‐
1607 man bind mounts /HOST-DIR in the host to /CONTAINER-DIR in the Podman
1608 container. Similarly, -v SOURCE-VOLUME:/CONTAINER-DIR will mount the
1609 volume in the host to the container. If no such named volume exists,
1610 Podman will create one. The OPTIONS are a comma-separated list and can
1611 be: [1] ⟨#Footnote1⟩ (Note when using the remote client, the volumes
1612 will be mounted from the remote server, not necessarily the client ma‐
1613 chine.)
1614
1615
1616 The options is a comma-separated list and can be:
1617
1618
1619 • rw|ro
1620
1621 • z|Z
1622
1623 • [r]shared|[r]slave|[r]private[r]unbindable
1624
1625 • [r]bind
1626
1627 • [no]exec
1628
1629 • [no]dev
1630
1631 • [no]suid
1632
1633 • [O]
1634
1635 • [U]
1636
1637
1638
1639 The CONTAINER-DIR must be an absolute path such as /src/docs. The vol‐
1640 ume will be mounted into the container at this directory.
1641
1642
1643 Volumes may specify a source as well, as either a directory on the host
1644 or the name of a named volume. If no source is given, the volume will
1645 be created as an anonymously named volume with a randomly generated
1646 name, and will be removed when the container is removed via the --rm
1647 flag or podman rm --volumes.
1648
1649
1650 If a volume source is specified, it must be a path on the host or the
1651 name of a named volume. Host paths are allowed to be absolute or rela‐
1652 tive; relative paths are resolved relative to the directory Podman is
1653 run in. If the source does not exist, Podman will return an error.
1654 Users must pre-create the source files or directories.
1655
1656
1657 Any source that does not begin with a . or / will be treated as the
1658 name of a named volume. If a volume with that name does not exist, it
1659 will be created. Volumes created with names are not anonymous, and
1660 they are not removed by the --rm option and the podman rm --volumes
1661 command.
1662
1663
1664 You can specify multiple -v options to mount one or more volumes into
1665 a container.
1666
1667
1668 Write Protected Volume Mounts
1669
1670
1671 You can add :ro or :rw suffix to a volume to mount it read-only or
1672 read-write mode, respectively. By default, the volumes are mounted
1673 read-write. See examples.
1674
1675
1676 Chowning Volume Mounts
1677
1678
1679 By default, Podman does not change the owner and group of source volume
1680 directories mounted into containers. If a container is created in a new
1681 user namespace, the UID and GID in the container may correspond to an‐
1682 other UID and GID on the host.
1683
1684
1685 The :U suffix tells Podman to use the correct host UID and GID based on
1686 the UID and GID within the container, to change recursively the owner
1687 and group of the source volume.
1688
1689
1690 Warning use with caution since this will modify the host filesystem.
1691
1692
1693 Labeling Volume Mounts
1694
1695
1696 Labeling systems like SELinux require that proper labels are placed on
1697 volume content mounted into a container. Without a label, the security
1698 system might prevent the processes running inside the container from
1699 using the content. By default, Podman does not change the labels set by
1700 the OS.
1701
1702
1703 To change a label in the container context, you can add either of two
1704 suffixes :z or :Z to the volume mount. These suffixes tell Podman to
1705 relabel file objects on the shared volumes. The z option tells Podman
1706 that two containers share the volume content. As a result, Podman la‐
1707 bels the content with a shared content label. Shared volume labels al‐
1708 low all containers to read/write content. The Z option tells Podman to
1709 label the content with a private unshared label. Only the current con‐
1710 tainer can use a private volume.
1711
1712
1713 Note: Do not relabel system files and directories. Relabeling system
1714 content might cause other confined services on your machine to fail.
1715 For these types of containers we recommend that disable SELinux separa‐
1716 tion. The option --security-opt label=disable disables SELinux separa‐
1717 tion for containers used in the build. For example if a user wanted to
1718 volume mount their entire home directory into a container, they need to
1719 disable SELinux separation.
1720
1721
1722 $ podman create --security-opt label=disable -v $HOME:/home/user fedora touch /home/user/file
1723
1724
1725
1726 Overlay Volume Mounts
1727
1728
1729 The :O flag tells Podman to mount the directory from the host as a tem‐
1730 porary storage using the overlay file system. The container processes
1731 can modify content within the mountpoint which is stored in the con‐
1732 tainer storage in a separate directory. In overlay terms, the source
1733 directory will be the lower, and the container storage directory will
1734 be the upper. Modifications to the mount point are destroyed when the
1735 container finishes executing, similar to a tmpfs mount point being un‐
1736 mounted.
1737
1738
1739 Subsequent executions of the container will see the original source di‐
1740 rectory content, any changes from previous container executions no
1741 longer exist.
1742
1743
1744 One use case of the overlay mount is sharing the package cache from the
1745 host into the container to allow speeding up builds.
1746
1747
1748 Note:
1749
1750
1751 - The `O` flag conflicts with other options listed above.
1752
1753
1754
1755 Content mounted into the container is labeled with the private label.
1756 On SELinux systems, labels in the source directory must be read‐
1757 able by the container label. Usually containers can read/execute con‐
1758 tainer_share_t and can read/write container_file_t. If you cannot
1759 change the labels on a source volume, SELinux container separation must
1760 be disabled for the container to work.
1761 - The source directory mounted into the container with an overlay
1762 mount should not be modified, it can cause unexpected failures. It is
1763 recommended that you do not modify the directory until the container
1764 finishes running.
1765
1766
1767 Mounts propagation
1768
1769
1770 By default bind mounted volumes are private. That means any mounts done
1771 inside container will not be visible on host and vice versa. One can
1772 change this behavior by specifying a volume mount propagation property.
1773 Making a volume shared mounts done under that volume inside container
1774 will be visible on host and vice versa. Making a volume slave enables
1775 only one way mount propagation and that is mounts done on host under
1776 that volume will be visible inside container but not the other way
1777 around. [1] ⟨#Footnote1⟩
1778
1779
1780 To control mount propagation property of a volume one can use the
1781 [r]shared, [r]slave, [r]private or the [r]unbindable propagation flag.
1782 Propagation property can be specified only for bind mounted volumes and
1783 not for internal volumes or named volumes. For mount propagation to
1784 work the source mount point (the mount point where source dir is
1785 mounted on) has to have the right propagation properties. For shared
1786 volumes, the source mount point has to be shared. And for slave vol‐
1787 umes, the source mount point has to be either shared or slave. [1]
1788 ⟨#Footnote1⟩
1789
1790
1791 If you want to recursively mount a volume and all of its submounts into
1792 a container, then you can use the rbind option. By default the bind op‐
1793 tion is used, and submounts of the source directory will not be mounted
1794 into the container.
1795
1796
1797 Mounting the volume with the nosuid options means that SUID applica‐
1798 tions on the volume will not be able to change their privilege. By de‐
1799 fault volumes are mounted with nosuid.
1800
1801
1802 Mounting the volume with the noexec option means that no executables on
1803 the volume will be able to executed within the container.
1804
1805
1806 Mounting the volume with the nodev option means that no devices on the
1807 volume will be able to be used by processes within the container. By
1808 default volumes are mounted with nodev.
1809
1810
1811 If the <source-dir> is a mount point, then "dev", "suid", and "exec"
1812 options are ignored by the kernel.
1813
1814
1815 Use df <source-dir> to figure out the source mount and then use findmnt
1816 -o TARGET,PROPAGATION <source-mount-dir> to figure out propagation
1817 properties of source mount. If findmnt utility is not available, then
1818 one can look at mount entry for source mount point in
1819 /proc/self/mountinfo. Look at optional fields and see if any propaga‐
1820 tion properties are specified. shared:X means mount is shared, mas‐
1821 ter:X means mount is slave and if nothing is there that means mount is
1822 private. [1] ⟨#Footnote1⟩
1823
1824
1825 To change propagation properties of a mount point use mount command.
1826 For example, if one wants to bind mount source directory /foo one can
1827 do mount --bind /foo /foo and mount --make-private --make-shared /foo.
1828 This will convert /foo into a shared mount point. Alternatively one can
1829 directly change propagation properties of source mount. Say / is source
1830 mount for /foo, then use mount --make-shared / to convert / into a
1831 shared mount.
1832
1833
1834 Note: if the user only has access rights via a group, accessing the
1835 volume from inside a rootless container will fail. Use the --group-add
1836 keep-groups flag to pass the user's supplementary group access into the
1837 container.
1838
1839
1840 --volumes-from[=CONTAINER[:OPTIONS]]
1841 Mount volumes from the specified container(s). Used to share volumes
1842 between containers. The options is a comma-separated list with the fol‐
1843 lowing available elements:
1844
1845
1846 • rw|ro
1847
1848 • z
1849
1850
1851
1852 Mounts already mounted volumes from a source container onto another
1853 container. You must supply the source's container-id or container-name.
1854 To share a volume, use the --volumes-from option when running the tar‐
1855 get container. You can share volumes even if the source container is
1856 not running.
1857
1858
1859 By default, Podman mounts the volumes in the same mode (read-write or
1860 read-only) as it is mounted in the source container. You can change
1861 this by adding a ro or rw option.
1862
1863
1864 Labeling systems like SELinux require that proper labels are placed on
1865 volume content mounted into a container. Without a label, the security
1866 system might prevent the processes running inside the container from
1867 using the content. By default, Podman does not change the labels set by
1868 the OS.
1869
1870
1871 To change a label in the container context, you can add z to the volume
1872 mount. This suffix tells Podman to relabel file objects on the shared
1873 volumes. The z option tells Podman that two containers share the volume
1874 content. As a result, Podman labels the content with a shared content
1875 label. Shared volume labels allow all containers to read/write content.
1876
1877
1878 If the location of the volume from the source container overlaps with
1879 data residing on a target container, then the volume hides that data on
1880 the target.
1881
1882
1883 --workdir, -w=dir
1884 Working directory inside the container
1885
1886
1887 The default working directory for running binaries within a container
1888 is the root directory (/). The image developer can set a different de‐
1889 fault with the WORKDIR instruction. The operator can override the work‐
1890 ing directory by using the -w option.
1891
1892
1893 --pidfile=path
1894 When the pidfile location is specified, the container process' PID will
1895 be written to the pidfile. (This option is not available with the re‐
1896 mote Podman client) If the pidfile option is not specified, the con‐
1897 tainer process' PID will be written to /run/containers/storage/${stor‐
1898 age-driver}-containers/$CID/userdata/pidfile.
1899
1900
1901 After the container is started, the location for the pidfile can be
1902 discovered with the following podman inspect command:
1903
1904
1905 $ podman inspect --format '{{ .PidFile }}' $CID
1906 /run/containers/storage/${storage-driver}-containers/$CID/userdata/pidfile
1907
1908
1909
1911 Create a container using a local image
1912 $ podman create alpine ls
1913
1914
1915
1916 Create a container using a local image and annotate it
1917 $ podman create --annotation HELLO=WORLD alpine ls
1918
1919
1920
1921 Create a container using a local image, allocating a pseudo-TTY, keeping
1922 stdin open and name it myctr
1923 podman create -t -i --name myctr alpine ls
1924
1925
1926
1927 Set UID/GID mapping in a new user namespace
1928 Running a container in a new user namespace requires a mapping of the
1929 uids and gids from the host.
1930
1931
1932 $ podman create --uidmap 0:30000:7000 --gidmap 0:30000:7000 fedora echo hello
1933
1934
1935
1936 Setting automatic user namespace separated containers
1937 # podman create --userns=auto:size=65536 ubi8-init
1938
1939
1940
1941 Configure timezone in a container
1942 $ podman create --tz=local alpine date
1943 $ podman create --tz=Asia/Shanghai alpine date
1944 $ podman create --tz=US/Eastern alpine date
1945
1946
1947
1948 Adding dependency containers
1949 Podman will make sure the first container, container1, is running be‐
1950 fore the second container (container2) is started.
1951
1952
1953 $ podman create --name container1 -t -i fedora bash
1954 $ podman create --name container2 --requires container1 -t -i fedora bash
1955 $ podman start --attach container2
1956
1957
1958
1959 Multiple containers can be required.
1960
1961
1962 $ podman create --name container1 -t -i fedora bash
1963 $ podman create --name container2 -t -i fedora bash
1964 $ podman create --name container3 --requires container1,container2 -t -i fedora bash
1965 $ podman start --attach container3
1966
1967
1968
1969 Configure keep supplemental groups for access to volume
1970 $ podman create -v /var/lib/design:/var/lib/design --group-add keep-groups ubi8
1971
1972
1973
1974 Configure execution domain for containers using personality flag
1975 $ podman create --name container1 --personaity=LINUX32 fedora bash
1976
1977
1978
1979 Rootless Containers
1980 Podman runs as a non root user on most systems. This feature requires
1981 that a new enough version of shadow-utils be installed. The shadow-
1982 utils package must include the newuidmap and newgidmap executables.
1983
1984
1985 Note: RHEL7 and Centos 7 will not have this feature until RHEL7.7 is
1986 released.
1987
1988
1989 In order for users to run rootless, there must be an entry for their
1990 username in /etc/subuid and /etc/subgid which lists the UIDs for their
1991 user namespace.
1992
1993
1994 Rootless Podman works better if the fuse-overlayfs and slirp4netns
1995 packages are installed. The fuse-overlayfs package provides a
1996 userspace overlay storage driver, otherwise users need to use the vfs
1997 storage driver, which is diskspace expensive and does not perform well.
1998 slirp4netns is required for VPN, without it containers need to be run
1999 with the --network=host flag.
2000
2001
2003 Environment variables within containers can be set using multiple dif‐
2004 ferent options: This section describes the precedence.
2005
2006
2007 Precedence order (later entries override earlier entries):
2008
2009
2010 • --env-host : Host environment of the process executing Podman
2011 is added.
2012
2013 • --http-proxy: By default, several environment variables will
2014 be passed in from the host, such as http_proxy and no_proxy.
2015 See --http-proxy for details.
2016
2017 • Container image : Any environment variables specified in the
2018 container image.
2019
2020 • --env-file : Any environment variables specified via env-
2021 files. If multiple files specified, then they override each
2022 other in order of entry.
2023
2024 • --env : Any environment variables specified will override pre‐
2025 vious settings.
2026
2027
2028
2029 Create containers and set the environment ending with a * and a *****
2030
2031
2032 $ export ENV1=a
2033 $ podman create --name ctr --env ENV* alpine printenv ENV1
2034 $ podman start --attach ctr
2035 a
2036
2037 $ podman create --name ctr --env ENV*****=b alpine printenv ENV*****
2038 $ podman start --attach ctr
2039 b
2040
2041
2042
2044 When Podman starts a container it actually executes the conmon program,
2045 which then executes the OCI Runtime. Conmon is the container monitor.
2046 It is a small program whose job is to watch the primary process of the
2047 container, and if the container dies, save the exit code. It also
2048 holds open the tty of the container, so that it can be attached to
2049 later. This is what allows Podman to run in detached mode (back‐
2050 grounded), so Podman can exit but conmon continues to run. Each con‐
2051 tainer has their own instance of conmon. Conmon waits for the container
2052 to exit, gathers and saves the exit code, and then launches a Podman
2053 process to complete the container cleanup, by shutting down the network
2054 and storage. For more information on conmon, please reference the
2055 conmon(8) man page.
2056
2057
2059 /etc/subuid /etc/subgid
2060
2061
2062 NOTE: Use the environment variable TMPDIR to change the temporary stor‐
2063 age location of downloaded container images. Podman defaults to use
2064 /var/tmp.
2065
2066
2068 podman(1), podman-secret(1), podman-save(1), podman-ps(1), podman-at‐
2069 tach(1), podman-pod-create(1), podman-port(1), *podman-start(1), pod‐
2070 man-kill(1), podman-stop(1), podman-generate-systemd(1) podman-rm(1),
2071 subgid(5), subuid(5), containers.conf(5), systemd.unit(5), setse‐
2072 bool(8), slirp4netns(1), fuse-overlayfs(1), proc(5), conmon(8), person‐
2073 ality(2).
2074
2075
2077 October 2017, converted from Docker documentation to Podman by Dan
2078 Walsh for Podman <dwalsh@redhat.com>
2079
2080
2081 November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
2082
2083
2084 September 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
2085
2086
2087 August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
2088
2089
2091 1: The Podman project is committed to inclusivity, a core value of open
2092 source. The master and slave mount propagation terminology used here is
2093 problematic and divisive, and should be changed. However, these terms
2094 are currently used within the Linux kernel and must be used as-is at
2095 this time. When the kernel maintainers rectify this usage, Podman will
2096 follow suit immediately.
2097
2098
2099
2100 podman-create(1)()