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.
52 Example: "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
76 internal storage. The docker-reference can also be an image ID
77 (docker-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
101 option can be set multiple times.
102
103
104 --annotation=key=value
105 Add an annotation to the container. The format is key=value. The
106 --annotation 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 commandline executables expect) and
122 pass along signals. The -a option can be set for each of stdin, stdout,
123 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:: join the namespace of the specified container.
157 ns:: 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.
200
201
202 --cpu-period=limit
203 Set the CPU period for the Completely Fair Scheduler (CFS), which is a
204 duration in microseconds. Once the container's CPU quota is used up, it
205 will not be scheduled to run until the current period ends. Defaults to
206 100000 microseconds.
207
208
209 On some systems, changing the CPU limits may not be allowed for
210 non-root users. For more details, see https://github.com/contain‐
211 ers/podman/blob/master/troubleshooting.md#26-running-contain‐
212 ers-with-cpu-limits-fails-with-a-permissions-error
213
214
215 --cpu-quota=limit
216 Limit the CPU Completely Fair Scheduler (CFS) quota.
217
218
219 Limit the container's CPU usage. By default, containers run with the
220 full CPU resource. The limit is a number in microseconds. If you pro‐
221 vide a number, the container will be allowed to use that much CPU time
222 until the CPU period ends (controllable via --cpu-period).
223
224
225 On some systems, changing the CPU limits may not be allowed for
226 non-root users. For more details, see https://github.com/contain‐
227 ers/podman/blob/master/troubleshooting.md#26-running-contain‐
228 ers-with-cpu-limits-fails-with-a-permissions-error
229
230
231 --cpu-rt-period=microseconds
232 Limit the CPU real-time period in microseconds
233
234
235 Limit the container's Real Time CPU usage. This flag tell the kernel to
236 restrict the container's Real Time CPU usage to the period you specify.
237
238
239 --cpu-rt-runtime=microseconds
240 Limit the CPU real-time runtime in microseconds
241
242
243 Limit the containers Real Time CPU usage. This flag tells the kernel to
244 limit the amount of time in a given CPU period Real Time tasks may con‐
245 sume. Ex: Period of 1,000,000us and Runtime of 950,000us means that
246 this container could consume 95% of available CPU and leave the remain‐
247 ing 5% to normal priority tasks.
248
249
250 The sum of all runtimes across containers cannot exceed the amount
251 allotted to the parent cgroup.
252
253
254 --cpu-shares=shares
255 CPU shares (relative weight)
256
257
258 By default, all containers get the same proportion of CPU cycles. This
259 proportion can be modified by changing the container's CPU share
260 weighting relative to the weighting of all other running containers.
261
262
263 To modify the proportion from the default of 1024, use the --cpu-shares
264 flag to set the weighting to 2 or higher.
265
266
267 The proportion will only apply when CPU-intensive processes are run‐
268 ning. When tasks in one container are idle, other containers can use
269 the left-over CPU time. The actual amount of CPU time will vary depend‐
270 ing on the number of containers running on the system.
271
272
273 For example, consider three containers, one has a cpu-share of 1024 and
274 two others have a cpu-share setting of 512. When processes in all three
275 containers attempt to use 100% of CPU, the first container would
276 receive 50% of the total CPU time. If you add a fourth container with a
277 cpu-share of 1024, the first container only gets 33% of the CPU. The
278 remaining containers receive 16.5%, 16.5% and 33% of the CPU.
279
280
281 On a multi-core system, the shares of CPU time are distributed over all
282 CPU cores. Even if a container is limited to less than 100% of CPU
283 time, it can use 100% of each individual CPU core.
284
285
286 For example, consider a system with more than three cores. If you start
287 one container {C0} with -c=512 running one process, and another con‐
288 tainer {C1} with -c=1024 running two processes, this can result in the
289 following division of CPU shares:
290
291
292 PID container CPU CPU share 100 {C0} 0 100% of
293 CPU0 101 {C1} 1 100% of CPU1 102
294 {C1} 2 100% of CPU2
295
296
297 --cpus=number
298 Number of CPUs. The default is 0.0 which means no limit. This is short‐
299 hand for --cpu-period and --cpu-quota, so you may only set either
300
301
302 --cpus or --cpu-period and --cpu-quota.
303 On some systems, changing the CPU limits may not be allowed for
304 non-root users. For more details, see https://github.com/contain‐
305 ers/podman/blob/master/troubleshooting.md#26-running-contain‐
306 ers-with-cpu-limits-fails-with-a-permissions-error
307
308
309 --cpuset-cpus=cpus
310 CPUs in which to allow execution (0-3, 0,1)
311
312
313 --cpuset-mems=nodes
314 Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effec‐
315 tive on NUMA systems.
316
317
318 If you have four memory nodes on your system (0-3), use
319 --cpuset-mems=0,1 then processes in your container will only use memory
320 from the first two memory nodes.
321
322
323 --device=host-device[:container-device][:permissions]
324 Add a host device to the container. Optional permissions parameter can
325 be used to specify device permissions, it is combination of r for read,
326 w for write, and m for mknod(2).
327
328
329 Example: --device=/dev/sdc:/dev/xvdc:rwm.
330
331
332 Note: if _hostdevice is a symbolic link then it will be resolved first.
333 The container will only store the major and minor numbers of the host
334 device.
335
336
337 Note: if the user only has access rights via a group, accessing the
338 device from inside a rootless container will fail. The crun(1) runtime
339 offers a workaround for this by adding the option --annotation
340 run.oci.keep_original_groups=1.
341
342
343 Podman may load kernel modules required for using the specified device.
344 The devices that podman will load modules when necessary are:
345 /dev/fuse.
346
347
348 --device-cgroup-rule="type major:minor mode"
349 Add a rule to the cgroup allowed devices list. The rule is expected to
350 be in the format specified in the Linux kernel documentation (Documen‐
351 tation/cgroup-v1/devices.txt):
352 - type: a (all), c (char), or b (block);
353 - major and minor: either a number, or * for all;
354 - mode: a composition of r (read), w (write), and m (mknod(2)).
355
356
357 --device-read-bps=path
358 Limit read rate (bytes per second) from a device (e.g.
359 --device-read-bps=/dev/sda:1mb)
360
361
362 --device-read-iops=path
363 Limit read rate (IO per second) from a device (e.g.
364 --device-read-iops=/dev/sda:1000)
365
366
367 --device-write-bps=path
368 Limit write rate (bytes per second) to a device (e.g.
369 --device-write-bps=/dev/sda:1mb)
370
371
372 --device-write-iops=path
373 Limit write rate (IO per second) to a device (e.g.
374 --device-write-iops=/dev/sda:1000)
375
376
377 --disable-content-trust
378 This is a Docker specific option to disable image verification to a
379 Docker registry and is not supported by Podman. This flag is a NOOP and
380 provided solely for scripting compatibility.
381
382
383 --dns=dns
384 Set custom DNS servers. Invalid if using --dns and --network that is
385 set to 'none' or 'container:'.
386
387
388 This option can be used to override the DNS configuration passed to the
389 container. Typically this is necessary when the host DNS configuration
390 is invalid for the container (e.g., 127.0.0.1). When this is the case
391 the --dns flags is necessary for every run.
392
393
394 The special value none can be specified to disable creation of
395 /etc/resolv.conf in the container by Podman. The /etc/resolv.conf file
396 in the image will be used without changes.
397
398
399 --dns-opt=option
400 Set custom DNS options. Invalid if using --dns-opt and --network that
401 is set to 'none' or 'container:'.
402
403
404 --dns-search=domain
405 Set custom DNS search domains. Invalid if using --dns-search and --net‐
406 work that is set to 'none' or 'container:'. (Use --dns-search=. if you
407 don't wish to set the search domain)
408
409
410 --entrypoint="command" | '["command", arg1 , ...]'
411 Overwrite the default ENTRYPOINT of the image
412
413
414 This option allows you to overwrite the default entrypoint of the
415 image. The ENTRYPOINT of an image is similar to a COMMAND because it
416 specifies what executable to run when the container starts, but it is
417 (purposely) more difficult to override. The ENTRYPOINT gives a con‐
418 tainer its default nature or behavior, so that when you set an ENTRY‐
419 POINT you can run the container as if it were that binary, complete
420 with default options, and you can pass in more options via the COMMAND.
421 But, sometimes an operator may want to run something else inside the
422 container, so you can override the default ENTRYPOINT at runtime by
423 using a --entrypoint and a string to specify the new ENTRYPOINT.
424
425
426 You need to specify multi option commands in the form of a json string.
427
428
429 --env, -e=env
430 Set environment variables
431
432
433 This option allows arbitrary environment variables that are available
434 for the process to be launched inside of the container. If an environ‐
435 ment variable is specified without a value, Podman will check the host
436 environment for a value and set the variable only if it is set on the
437 host. If an environment variable ending in * is specified, Podman will
438 search the host environment for variables starting with the prefix and
439 will add those variables to the container. If an environment variable
440 with a trailing ***** is specified, then a value must be supplied.
441
442
443 See Environment ⟨#environment⟩ note below for precedence and examples.
444
445
446 --env-host=true|false
447 Use host environment inside of the container. See Environment note
448 below for precedence. (Not available for remote commands)
449
450
451 --env-file=file
452 Read in a line delimited file of environment variables. See Environment
453 note below for precedence.
454
455
456 --expose=port
457 Expose a port, or a range of ports (e.g. --expose=3300-3310) to set up
458 port redirection on the host system.
459
460
461 --gidmap=container_gid:host_gid:amount
462 GID map for the user namespace. Using this flag will run the container
463 with user namespace enabled. It conflicts with the --userns and --sub‐
464 gidname flags.
465
466
467 The following example maps uids 0-2000 in the container to the uids
468 30000-31999 on the host and gids 0-2000 in the container to the gids
469 30000-31999 on the host. --gidmap=0:30000:2000
470
471
472 --group-add=group
473 Add additional groups to run as
474
475
476 --health-cmd="command" | '["command", arg1 , ...]'
477 Set or alter a healthcheck command for a container. The command is a
478 command to be executed inside your container that determines your con‐
479 tainer health. The command is required for other healthcheck options to
480 be applied. A value of none disables existing healthchecks.
481
482
483 Multiple options can be passed in the form of a JSON array; otherwise,
484 the command will be interpreted as an argument to /bin/sh -c.
485
486
487 --health-interval=interval
488 Set an interval for the healthchecks (a value of disable results in no
489 automatic timer setup) (default "30s")
490
491
492 --health-retries=retries
493 The number of retries allowed before a healthcheck is considered to be
494 unhealthy. The default value is 3.
495
496
497 --health-start-period=period
498 The initialization time needed for a container to bootstrap. The value
499 can be expressed in time format like 2m3s. The default value is 0s
500
501
502 --health-timeout=timeout
503 The maximum time allowed to complete the healthcheck before an interval
504 is considered failed. Like start-period, the value can be expressed in
505 a time format such as 1m22s. The default value is 30s.
506
507
508 --hostname=name, -h
509 Container host name
510
511
512 Sets the container host name that is available inside the container.
513 Can only be used with a private UTS namespace --uts=private (default).
514 If --pod is specified and the pod shares the UTS namespace (default)
515 the pod's hostname will be used.
516
517
518 --help
519 Print usage statement
520
521
522 --http-proxy=true|false
523 By default proxy environment variables are passed into the container if
524 set for the Podman process. This can be disabled by setting the
525 --http-proxy option to false. The environment variables passed in
526 include http_proxy, https_proxy, ftp_proxy, no_proxy, and also the
527 upper case versions of those. This option is only needed when the host
528 system must use a proxy but the container should not use any proxy.
529 Proxy environment variables specified for the container in any other
530 way will override the values that would have been passed through from
531 the host. (Other ways to specify the proxy for the container include
532 passing the values with the --env flag, or hard coding the proxy envi‐
533 ronment at container build time.) (Not available for remote commands)
534
535
536 For example, to disable passing these environment variables from host
537 to container:
538
539
540 --http-proxy=false
541
542
543 Defaults to true
544
545
546 --image-volume, builtin-volume=bind|tmpfs|ignore
547 Tells Podman how to handle the builtin image volumes. Default is bind.
548
549
550 · bind: An anonymous named volume will be created and mounted
551 into the container.
552
553 · tmpfs: The volume is mounted onto the container as a tmpfs,
554 which allows the users to create content that disappears when
555 the container is stopped.
556
557 · ignore: All volumes are just ignored and no action is taken.
558
559
560
561 --init
562 Run an init inside the container that forwards signals and reaps pro‐
563 cesses.
564
565
566 --init-path=path
567 Path to the container-init binary.
568
569
570 --interactive, -i=true|false
571 Keep STDIN open even if not attached. The default is false.
572
573
574 --ip6=ip
575 Not implemented
576
577
578 --ip=ip
579 Specify a static IP address for the container, for example
580 10.88.64.128. This option can only be used if the container is joined
581 to only a single network - i.e., --network=_network-name_ is used at
582 most once - and if the container is not joining another container's
583 network namespace via --network=container:_id_. The address must be
584 within the CNI network's IP address pool (default 10.88.0.0/16).
585
586
587 --ipc=ipc
588 Default is to create a private IPC namespace (POSIX SysV IPC) for the
589 container 'container:': reuses another container shared mem‐
590 ory, semaphores and message queues 'host': use the host
591 shared memory,semaphores and message queues inside the container. Note:
592 the host mode gives the container full access to local shared memory
593 and is therefore considered insecure. 'ns:' path to an IPC
594 namespace to join.
595
596
597 --kernel-memory=number[unit]
598 Kernel memory limit (format: <number>[<unit>], where unit = b (bytes),
599 k (kilobytes), m (megabytes), or g (gigabytes))
600
601
602 Constrains the kernel memory available to a container. If a limit of 0
603 is specified (not using --kernel-memory), the container's kernel memory
604 is not limited. If you specify a limit, it may be rounded up to a mul‐
605 tiple of the operating system's page size and the value can be very
606 large, millions of trillions.
607
608
609 --label, -l=label
610 Add metadata to a container (e.g., --label com.example.key=value)
611
612
613 --label-file=file
614 Read in a line delimited file of labels
615
616
617 --link-local-ip=ip
618 Not implemented
619
620
621 --log-driver="k8s-file"
622 Logging driver for the container. Currently available options are
623 k8s-file, journald, and none, with json-file aliased to k8s-file for
624 scripting compatibility.
625
626
627 --log-opt=name=value
628 Set custom logging configuration. The following *name*s are supported:
629
630
631 · path: specify a path to the log file (e.g. --log-opt
632 path=/var/log/container/mycontainer.json);
633
634 · max-size: specify a max size of the log file (e.g. --log-opt
635 max-size=10mb);
636
637 · tag: specify a custom log tag for the container (e.g.
638 --log-opt tag="{{.ImageName}}".
639
640
641
642 It supports the same keys as podman inspect --format.
643
644
645 This option is currently supported only by the journald log driver.
646
647
648 --log-opt tag="{{.ImageName}}"
649
650
651 It supports the same keys as podman inspect --format.
652
653
654 It is currently supported only by the journald log driver.
655
656
657 --mac-address=address
658 Container MAC address (e.g. 92:d0:c6:0a:29:33)
659
660
661 Remember that the MAC address in an Ethernet network must be unique.
662 The IPv6 link-local address will be based on the device's MAC address
663 according to RFC4862.
664
665
666 --memory, -m=limit
667 Memory limit (format: [], where unit = b (bytes), k (kilobytes), m
668 (megabytes), or g (gigabytes))
669
670
671 Allows you to constrain the memory available to a container. If the
672 host supports swap memory, then the -m memory setting can be larger
673 than physical RAM. If a limit of 0 is specified (not using -m), the
674 container's memory is not limited. The actual limit may be rounded up
675 to a multiple of the operating system's page size (the value would be
676 very large, that's millions of trillions).
677
678
679 --memory-reservation=limit
680 Memory soft limit (format: [], where unit = b (bytes), k (kilobytes), m
681 (megabytes), or g (gigabytes))
682
683
684 After setting memory reservation, when the system detects memory con‐
685 tention or low memory, containers are forced to restrict their consump‐
686 tion to their reservation. So you should always set the value below
687 --memory, otherwise the hard limit will take precedence. By default,
688 memory reservation will be the same as memory limit.
689
690
691 --memory-swap=limit
692 A limit value equal to memory plus swap. Must be used with the -m
693 (--memory) flag. The swap LIMIT should always be larger than -m (--mem‐
694 ory) value. By default, the swap LIMIT will be set to double the value
695 of --memory.
696
697
698 The format of LIMIT is <number>[<unit>]. Unit can be b (bytes), k
699 (kilobytes), m (megabytes), or g (gigabytes). If you don't specify a
700 unit, b is used. Set LIMIT to -1 to enable unlimited swap.
701
702
703 --memory-swappiness=number
704 Tune a container's memory swappiness behavior. Accepts an integer
705 between 0 and 100.
706
707
708 --mount=type=TYPE,TYPE-SPECIFIC-OPTION[,...]
709 Attach a filesystem mount to the container
710
711
712 Current supported mount TYPEs are bind, volume, image, tmpfs and
713 devpts. [1] ⟨#Footnote1⟩
714
715
716 e.g.
717
718 type=bind,source=/path/on/host,destination=/path/in/container
719
720 type=bind,src=/path/on/host,dst=/path/in/container,relabel=shared
721
722 type=volume,source=vol1,destination=/path/in/container,ro=true
723
724 type=tmpfs,tmpfs-size=512M,destination=/path/in/container
725
726 type=image,source=fedora,destination=/fedora-image,rw=true
727
728 type=devpts,destination=/dev/pts
729
730 Common Options:
731
732 · src, source: mount source spec for bind and volume. Mandatory for bind.
733
734 · dst, destination, target: mount destination spec.
735
736 Options specific to volume:
737
738 · ro, readonly: true or false (default).
739
740 Options specific to image:
741
742 · rw, readwrite: true or false (default).
743
744 Options specific to bind:
745
746 · ro, readonly: true or false (default).
747
748 · bind-propagation: shared, slave, private, unbindable, rshared, rslave, runbindable, or rprivate(default). See also mount(2).
749
750 . bind-nonrecursive: do not setup a recursive bind mount. By default it is recursive.
751
752 . relabel: shared, private.
753
754 Options specific to tmpfs:
755
756 · ro, readonly: true or false (default).
757
758 · tmpfs-size: Size of the tmpfs mount in bytes. Unlimited by default in Linux.
759
760 · tmpfs-mode: File mode of the tmpfs in octal. (e.g. 700 or 0700.) Defaults to 1777 in Linux.
761
762 · tmpcopyup: Enable copyup from the image directory at the same location to the tmpfs. Used by default.
763
764 · notmpcopyup: Disable copying files from the image to the tmpfs.
765
766
767
768 --name=name
769 Assign a name to the container
770
771
772 The operator can identify a container in three ways: UUID long identi‐
773 fier
774 (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”)
775 UUID short identifier (“f78375b1c487”) Name (“jonah”)
776
777
778 podman generates a UUID for each container, and if a name is not
779 assigned to the container with --name then it will generate a random
780 string name. The name is useful any place you need to identify a con‐
781 tainer. This works for both background and foreground containers.
782
783
784 --network=mode, --net
785 Set the network mode for the container. Invalid if using --dns,
786 --dns-opt, or --dns-search with --network that is set to none or con‐
787 tainer:id. If used together with --pod, the container will not join the
788 pod's network namespace.
789
790
791 Valid mode values are:
792
793
794 · bridge: create a network stack on the default bridge;
795
796 · none: no networking;
797
798 · container:id: reuse another container's network stack;
799
800 · host: use the Podman host network stack. Note: the host mode
801 gives the container full access to local system services such
802 as D-bus and is therefore considered insecure;
803
804 · network-id: connect to a user-defined network, multiple net‐
805 works should be comma separated;
806
807 · ns:path: path to a network namespace to join;
808
809 · private: create a new namespace for the container (default)
810
811 · slirp4netns[:OPTIONS,...]: use slirp4netns(1) to create a user
812 network stack. This is the default for rootless containers. It
813 is possible to specify these additional options:
814
815 · allow_host_loopback=true|false: Allow the slirp4netns to
816 reach the host loopback IP (10.0.2.2). Default is false.
817
818 · mtu=MTU: Specify the MTU to use for this network. (Default
819 is 65520).
820
821 · cidr=CIDR: Specify ip range to use for this network.
822 (Default is 10.0.2.0/24).
823
824 · enable_ipv6=true|false: Enable IPv6. Default is false.
825 (Required for outbound_addr6).
826
827 · outbound_addr=INTERFACE: Specify the outbound interface
828 slirp should bind to (ipv4 traffic only).
829
830 · outbound_addr=IPv4: Specify the outbound ipv4 address slirp
831 should bind to.
832
833 · outbound_addr6=INTERFACE: Specify the outbound interface
834 slirp should bind to (ipv6 traffic only).
835
836 · outbound_addr6=IPv6: Specify the outbound ipv6 address slirp
837 should bind to.
838
839 · port_handler=rootlesskit: Use rootlesskit for port forward‐
840 ing. Default.
841
842 · port_handler=slirp4netns: Use the slirp4netns port forward‐
843 ing.
844
845
846
847
848
849 --network-alias=alias
850 Add network-scoped alias for the container
851
852
853 --no-healthcheck=true|false
854 Disable any defined healthchecks for container.
855
856
857 --no-hosts=true|false
858 Do not create /etc/hosts for the container. By default, Podman will
859 manage /etc/hosts, adding the container's own IP address and any hosts
860 from --add-host.
861
862
863 --no-hosts disables this, and the image's /etc/host will be preserved
864 unmodified.
865 This option conflicts with --add-host.
866
867
868 --oom-kill-disable=true|false
869 Whether to disable OOM Killer for the container or not.
870
871
872 --oom-score-adj=num
873 Tune the host's OOM preferences for containers (accepts -1000 to 1000)
874
875
876 --os=OS
877 Override the OS, defaults to hosts, of the image to be pulled. For
878 example, windows.
879
880
881 --pid=pid
882 Set the PID mode for the container Default is to create a private PID
883 namespace for the container - container:<name|id>: join another con‐
884 tainer's PID namespace - host: use the host's PID namespace for the
885 container. Note: the host mode gives the container full access to local
886 PID and is therefore considered insecure. - ns: join the specified PID
887 namespace - private: create a new namespace for the container (default)
888
889
890 --pids-limit=limit
891 Tune the container's pids limit. Set 0 to have unlimited pids for the
892 container. (default "4096" on systems that support PIDS cgroups).
893
894
895 --platform=OS/ARCH
896 Specify the platform for selecting the image. (Conflicts with --arch
897 and --os) The --platform option can be used to override the current
898 architecture and operating system.
899
900
901 --pod=name
902 Run container in an existing pod. If you want Podman to make the pod
903 for you, preference the pod name with new:. To make a pod with more
904 granular options, use the podman pod create command before creating a
905 container.
906
907
908 --pod-id-file=path
909 Run container in an existing pod and read the pod's ID from the speci‐
910 fied file. If a container is run within a pod, and the pod has an
911 infra-container, the infra-container will be started before the con‐
912 tainer is.
913
914
915 --privileged=true|false
916 Give extended privileges to this container. The default is false.
917
918
919 By default, Podman containers are “unprivileged” (=false) and cannot,
920 for example, modify parts of the operating system. This is because by
921 default a container is not allowed to access any devices. A “privi‐
922 leged” container is given access to all devices.
923
924
925 When the operator executes a privileged container, Podman enables
926 access to all devices on the host, turns off graphdriver mount options,
927 as well as turning off most of the security measures protecting the
928 host from the container.
929
930
931 Rootless containers cannot have more privileges than the account that
932 launched them.
933
934
935 --publish, -p=port
936 Publish a container's port, or range of ports, to the host
937
938
939 Format: ip:hostPort:containerPort | ip::containerPort | hostPort:con‐
940 tainerPort | containerPort Both hostPort and containerPort can be spec‐
941 ified as a range of ports. When specifying ranges for both, the number
942 of container ports in the range must match the number of host ports in
943 the range. (e.g., podman run -p 1234-1236:1222-1224 --name thisWorks
944 -t busybox but not podman run -p 1230-1236:1230-1240 --name RangeCon‐
945 tainerPortsBiggerThanRangeHostPorts -t busybox) With host IP: podman
946 run -p 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage
947 If host IP is set to 0.0.0.0 or not set at all, the port will be bound
948 on all IPs on the host. Host port does not have to be specified (e.g.
949 podman run -p 127.0.0.1::80). If it is not, the container port will be
950 randomly assigned a port on the host. Use podman port to see the
951 actual mapping: podman port CONTAINER $CONTAINERPORT
952
953
954 Note: if a container will be run within a pod, it is not necessary to
955 publish the port for the containers in the pod. The port must only be
956 published by the pod itself. Pod network stacks act like the network
957 stack on the host - you have a variety of containers in the pod, and
958 programs in the container, all sharing a single interface and IP
959 address, and associated ports. If one container binds to a port, no
960 other container can use that port within the pod while it is in use.
961 Containers in the pod can also communicate over localhost by having one
962 container bind to localhost in the pod, and another connect to that
963 port.
964
965
966 --publish-all, -P=true|false
967 Publish all exposed ports to random ports on the host interfaces. The
968 default is false.
969
970
971 When set to true publish all exposed ports to the host interfaces. The
972 default is false. If the operator uses -P (or -p) then Podman will make
973 the exposed port accessible on the host and the ports will be available
974 to any client that can reach the host. When using -P, Podman will bind
975 any exposed port to a random port on the host within an ephemeral port
976 range defined by /proc/sys/net/ipv4/ip_local_port_range. To find the
977 mapping between the host ports and the exposed ports, use podman port.
978
979
980 --pull=missing
981 Pull image before creating ("always"|"missing"|"never") (default "miss‐
982 ing").
983 'missing': default value, attempt to pull the latest image from
984 the registries listed in registries.conf if a local image does not
985 exist.Raise an error if the image is not in any listed registry and is
986 not present locally.
987 'always': Pull the image from the first registry it is found in
988 as listed in registries.conf. Raise an error if not found in the reg‐
989 istries, even if the image is present locally.
990 'never': do not pull the image from the registry, use only the
991 local version. Raise an error if the image is not present locally.
992
993
994 Defaults to missing.
995
996
997 --quiet, -q
998 Suppress output information when pulling images
999
1000
1001 --read-only=true|false
1002 Mount the container's root filesystem as read only.
1003
1004
1005 By default a container will have its root filesystem writable allowing
1006 processes to write files anywhere. By specifying the --read-only flag
1007 the container will have its root filesystem mounted as read only pro‐
1008 hibiting any writes.
1009
1010
1011 --read-only-tmpfs=true|false
1012 If container is running in --read-only mode, then mount a read-write
1013 tmpfs on /run, /tmp, and /var/tmp. The default is true
1014
1015
1016 --replace=true|false
1017 If another container with the same name already exists, replace and
1018 remove it. The default is false.
1019
1020
1021 --restart=policy
1022 Restart policy to follow when containers exit. Restart policy will not
1023 take effect if a container is stopped via the podman kill or podman
1024 stop commands.
1025
1026
1027 Valid values are:
1028
1029
1030 · no : Do not restart containers on exit
1031
1032 · on-failure[:max_retries] : Restart containers when they exit
1033 with a non-0 exit code, retrying indefinitely or until the
1034 optional max_retries count is hit
1035
1036 · always : Restart containers when they exit,
1037 regardless of status, retrying indefinitely
1038
1039 · unless-stopped : Identical to always
1040
1041
1042
1043 Please note that restart will not restart containers after a system
1044 reboot. If this functionality is required in your environment, you can
1045 invoke Podman from a systemd unit file, or create an init script for
1046 whichever init system is in use. To generate systemd unit files,
1047 please see podman generate systemd
1048
1049
1050 --rm=true|false
1051 Automatically remove the container when it exits. The default is false.
1052
1053
1054 --rootfs
1055 If specified, the first argument refers to an exploded container on the
1056 file system.
1057
1058
1059 This is useful to run a container without requiring any image manage‐
1060 ment, the rootfs of the container is assumed to be managed externally.
1061
1062
1063 --sdnotify=container|conmon|ignore
1064 Determines how to use the NOTIFY_SOCKET, as passed with systemd and
1065 Type=notify.
1066
1067
1068 Default is container, which means allow the OCI runtime to proxy the
1069 socket into the container to receive ready notification. Podman will
1070 set the MAINPID to conmon's pid. The conmon option sets MAINPID to
1071 conmon's pid, and sends READY when the container has started. The
1072 socket is never passed to the runtime or the container. The ignore
1073 option removes NOTIFY_SOCKET from the environment for itself and child
1074 processes, for the case where some other process above Podman uses
1075 NOTIFY_SOCKET and Podman should not use it.
1076
1077
1078 --seccomp-policy=policy
1079 Specify the policy to select the seccomp profile. If set to image, Pod‐
1080 man will look for a "io.podman.seccomp.profile" label in the con‐
1081 tainer-image config and use its value as a seccomp profile. Otherwise,
1082 Podman will follow the default policy by applying the default profile
1083 unless specified otherwise via --security-opt seccomp as described
1084 below.
1085
1086
1087 Note that this feature is experimental and may change in the future.
1088
1089
1090 --security-opt=option
1091 Security Options
1092
1093
1094 · apparmor=unconfined : Turn off apparmor confinement for the
1095 container
1096
1097 · apparmor=your-profile : Set the apparmor confinement profile
1098 for the container
1099
1100 · label=user:USER : Set the label user for the container
1101 processes
1102
1103 · label=role:ROLE : Set the label role for the container
1104 processes
1105
1106 · label=type:TYPE : Set the label process type for the con‐
1107 tainer processes
1108
1109 · label=level:LEVEL : Set the label level for the container
1110 processes
1111
1112 · label=filetype:TYPE : Set the label file type for the con‐
1113 tainer files
1114
1115 · label=disable : Turn off label separation for the con‐
1116 tainer
1117
1118 · mask=/path/1:/path/2 : The paths to mask separated by a colon.
1119 A masked path cannot be accessed inside the container.
1120
1121 · no-new-privileges : Disable container processes from gaining
1122 additional privileges
1123
1124 · seccomp=unconfined : Turn off seccomp confinement for the con‐
1125 tainer
1126
1127 · seccomp=profile.json : White listed syscalls seccomp Json
1128 file to be used as a seccomp filter
1129
1130 · unmask=ALL or /path/1:/path/2 : Paths to unmask separated by a
1131 colon. If set to ALL, it will unmask all the paths that are
1132 masked or made read only by default. The default masked paths
1133 are /proc/acpi, /proc/kcore, /proc/keys, /proc/latency_stats,
1134 /proc/sched_debug, /proc/scsi, /proc/timer_list,
1135 /proc/timer_stats, /sys/firmware, and /sys/fs/selinux. The
1136 default paths that are read only are /proc/asound, /proc/bus,
1137 /proc/fs, /proc/irq, /proc/sys, /proc/sysrq-trigger.
1138
1139 · proc-opts=OPTIONS : Comma separated list of options to use for
1140 the /proc mount. More details for the possible mount options
1141 are specified at proc(5) man page.
1142
1143
1144
1145 Note: Labeling can be disabled for all containers by setting
1146 label=false in the containers.conf (/etc/containers/containers.conf or
1147 $HOME/.config/containers/containers.conf) file.
1148
1149
1150 --shm-size=size
1151 Size of /dev/shm (format: [], where unit = b (bytes), k (kilobytes), m
1152 (megabytes), or g (gigabytes)) If you omit the unit, the system uses
1153 bytes. If you omit the size entirely, the system uses 64m. When size
1154 is 0, there is no limit on the amount of memory used for IPC by the
1155 container.
1156
1157
1158 --stop-signal=SIGTERM
1159 Signal to stop a container. Default is SIGTERM.
1160
1161
1162 --stop-timeout=seconds
1163 Timeout (in seconds) to stop a container. Default is 10. Remote con‐
1164 nections use local containers.conf for defaults
1165
1166
1167 --subgidname=name
1168 Name for GID map from the /etc/subgid file. Using this flag will run
1169 the container with user namespace enabled. This flag conflicts with
1170 --userns and --gidmap.
1171
1172
1173 --subuidname=name
1174 Name for UID map from the /etc/subuid file. Using this flag will run
1175 the container with user namespace enabled. This flag conflicts with
1176 --userns and --uidmap.
1177
1178
1179 --sysctl=SYSCTL
1180 Configure namespaced kernel parameters at runtime
1181
1182
1183 IPC Namespace - current sysctls allowed:
1184
1185
1186 kernel.msgmax, kernel.msgmnb, kernel.msgmni, kernel.sem, kernel.shmall,
1187 kernel.shmmax, kernel.shmmni, kernel.shm_rmid_forced Sysctls beginning
1188 with fs.mqueue.*
1189
1190
1191 Note: if you use the --ipc=host option these sysctls will not be
1192 allowed.
1193
1194
1195 Network Namespace - current sysctls allowed:
1196 Sysctls beginning with net.*
1197
1198
1199 Note: if you use the --network=host option these sysctls will not be
1200 allowed.
1201
1202
1203 --systemd=true|false|always
1204 Run container in systemd mode. The default is true.
1205
1206
1207 The value always enforces the systemd mode is enforced without looking
1208 at the executable name. Otherwise, if set to true and the command you
1209 are running inside the container is systemd, /usr/sbin/init, /sbin/init
1210 or /usr/local/sbin/init.
1211
1212
1213 If the command you are running inside of the container is systemd, Pod‐
1214 man will setup tmpfs mount points in the following directories:
1215
1216
1217 /run, /run/lock, /tmp, /sys/fs/cgroup/systemd, /var/lib/journal
1218
1219
1220 It will also set the default stop signal to SIGRTMIN+3.
1221
1222
1223 This allow systemd to run in a confined container without any modifica‐
1224 tions.
1225
1226
1227 Note: On SELinux systems, systemd attempts to write to the cgroup file
1228 system. Containers writing to the cgroup file system are denied by
1229 default. The container_manage_cgroup boolean must be enabled for this
1230 to be allowed on an SELinux separated system.
1231
1232
1233 setsebool -P container_manage_cgroup true
1234
1235
1236 --tmpfs=fs
1237 Create a tmpfs mount
1238
1239
1240 Mount a temporary filesystem (tmpfs) mount into a container, for exam‐
1241 ple:
1242
1243
1244 $ podman create -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image
1245
1246
1247 This command mounts a tmpfs at /tmp within the container. The supported
1248 mount options are the same as the Linux default mount flags. If you do
1249 not specify any options, the systems uses the following options:
1250 rw,noexec,nosuid,nodev.
1251
1252
1253 --tty, -t=true|false
1254 Allocate a pseudo-TTY. The default is false.
1255
1256
1257 When set to true Podman will allocate a pseudo-tty and attach to the
1258 standard input of the container. This can be used, for example, to run
1259 a throwaway interactive shell. The default is false.
1260
1261
1262 Note: The -t option is incompatible with a redirection of the Podman
1263 client standard input.
1264
1265
1266 --tz=timezone
1267 Set timezone in container. This flag takes area-based timezones, GMT
1268 time, as well as local, which sets the timezone in the container to
1269 match the host machine. See /usr/share/zoneinfo/ for valid timezones.
1270 Remote connections use local containers.conf for defaults
1271
1272
1273 --umask=umask
1274 Set the umask inside the container. Defaults to 0022. Remote connec‐
1275 tions use local containers.conf for defaults
1276
1277
1278 --uidmap=container_uid:host_uid:amount
1279 UID map for the user namespace. Using this flag will run the container
1280 with user namespace enabled. It conflicts with the --userns and --sub‐
1281 uidname flags.
1282
1283
1284 The following example maps uids 0-2000 in the container to the uids
1285 30000-31999 on the host and gids 0-2000 in the container to the gids
1286 30000-31999 on the host. --uidmap=0:30000:2000
1287
1288
1289 --ulimit=option
1290 Ulimit options
1291
1292
1293 You can pass host to copy the current configuration from the host.
1294
1295
1296 --user, -u=user
1297 Sets the username or UID used and optionally the groupname or GID for
1298 the specified command.
1299
1300
1301 The following examples are all valid: --user [user | user:group | uid |
1302 uid:gid | user:gid | uid:group ]
1303
1304
1305 Without this argument the command will be run as root in the container.
1306
1307
1308 --userns=auto[:OPTIONS]
1309 --userns=host
1310 --userns=keep-id
1311 --userns=container:container
1312 --userns=private
1313 --userns=ns:my_namespace
1314 Set the user namespace mode for the container. It defaults to the POD‐
1315 MAN_USERNS environment variable. An empty value means user namespaces
1316 are disabled.
1317
1318
1319 · auto: automatically create a namespace. It is possible to
1320 specify other options to auto. The supported options are
1321 size=SIZE to specify an explicit size for the automatic user
1322 namespace. e.g. --userns=auto:size=8192. If size is not speci‐
1323 fied, auto will guess a size for the user namespace. uidmap‐
1324 ping=HOST_UID:CONTAINER_UID:SIZE to force a UID mapping to be
1325 present in the user namespace. gidmapping=HOST_UID:CON‐
1326 TAINER_UID:SIZE to force a GID mapping to be present in the
1327 user namespace.
1328
1329 · container: join the user namespace of the specified container.
1330
1331 · host: run in the user namespace of the caller. This is the
1332 default if no user namespace options are set. The processes
1333 running in the container will have the same privileges on the
1334 host as any other process launched by the calling user.
1335
1336 · keep-id: creates a user namespace where the current rootless
1337 user's UID:GID are mapped to the same values in the container.
1338 This option is ignored for containers created by the root
1339 user.
1340
1341 · ns: run the container in the given existing user namespace.
1342
1343 · private: create a new namespace for the container (default)
1344
1345
1346
1347 This option is incompatible with --gidmap, --uidmap, --subuidname and
1348 --subgidname.
1349
1350
1351 --uts=mode
1352 Set the UTS namespace mode for the container. The following values are
1353 supported:
1354
1355
1356 · host: use the host's UTS namespace inside the container.
1357
1358 · private: create a new namespace for the container (default).
1359
1360 · ns:[path]: run the container in the given existing UTS names‐
1361 pace.
1362
1363 · container:[container]: join the UTS namespace of the specified
1364 container.
1365
1366
1367
1368 --variant=VARIANT
1369 Use VARIANT instead of the default architecture variant of the con‐
1370 tainer image. Some images can use multiple variants of the arm archi‐
1371 tectures, such as arm/v5 and arm/v7.
1372
1373
1374 --volume, -v[=[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]]
1375 Create a bind mount. If you specify, -v /HOST-DIR:/CONTAINER-DIR, Pod‐
1376 man bind mounts /HOST-DIR in the host to /CONTAINER-DIR in the Podman
1377 container. Similarly, -v SOURCE-VOLUME:/CONTAINER-DIR will mount the
1378 volume in the host to the container. If no such named volume exists,
1379 Podman will create one. The OPTIONS are a comma delimited list and can
1380 be: [1] ⟨#Footnote1⟩
1381
1382
1383 The options is a comma delimited list and can be:
1384
1385
1386 · rw|ro
1387
1388 · z|Z
1389
1390 · [r]shared|[r]slave|[r]private[r]unbindable
1391
1392 · [r]bind
1393
1394 · [no]exec
1395
1396 · [no]dev
1397
1398 · [no]suid
1399
1400 · [O]
1401
1402
1403
1404 The CONTAINER-DIR must be an absolute path such as /src/docs. The vol‐
1405 ume will be mounted into the container at this directory.
1406
1407
1408 Volumes may specify a source as well, as either a directory on the host
1409 or the name of a named volume. If no source is given, the volume will
1410 be created as an anonymously named volume with a randomly generated
1411 name, and will be removed when the container is removed via the --rm
1412 flag or podman rm --volumes.
1413
1414
1415 If a volume source is specified, it must be a path on the host or the
1416 name of a named volume. Host paths are allowed to be absolute or rela‐
1417 tive; relative paths are resolved relative to the directory Podman is
1418 run in. If the source does not exist, Podman will return an error.
1419 Users must pre-create the source files or directories.
1420
1421
1422 Any source that does not begin with a . or / will be treated as the
1423 name of a named volume. If a volume with that name does not exist, it
1424 will be created. Volumes created with names are not anonymous, and
1425 they are not removed by the --rm option and the podman rm --volumes
1426 command.
1427
1428
1429 You can specify multiple -v options to mount one or more volumes into
1430 a container.
1431
1432
1433 Write Protected Volume Mounts
1434
1435
1436 You can add :ro or :rw suffix to a volume to mount it read-only or
1437 read-write mode, respectively. By default, the volumes are mounted
1438 read-write. See examples.
1439
1440
1441 Labeling Volume Mounts
1442
1443
1444 Labeling systems like SELinux require that proper labels are placed on
1445 volume content mounted into a container. Without a label, the security
1446 system might prevent the processes running inside the container from
1447 using the content. By default, Podman does not change the labels set by
1448 the OS.
1449
1450
1451 To change a label in the container context, you can add either of two
1452 suffixes :z or :Z to the volume mount. These suffixes tell Podman to
1453 relabel file objects on the shared volumes. The z option tells Podman
1454 that two containers share the volume content. As a result, Podman
1455 labels the content with a shared content label. Shared volume labels
1456 allow all containers to read/write content. The Z option tells Podman
1457 to label the content with a private unshared label. Only the current
1458 container can use a private volume.
1459
1460
1461 Overlay Volume Mounts
1462
1463
1464 The :O flag tells Podman to mount the directory from the host as a tem‐
1465 porary storage using the overlay file system. The container processes
1466 can modify content within the mountpoint which is stored in the con‐
1467 tainer storage in a separate directory. In overlay terms, the source
1468 directory will be the lower, and the container storage directory will
1469 be the upper. Modifications to the mount point are destroyed when the
1470 container finishes executing, similar to a tmpfs mount point being
1471 unmounted.
1472
1473
1474 Subsequent executions of the container will see the original source
1475 directory content, any changes from previous container executions no
1476 longer exist.
1477
1478
1479 One use case of the overlay mount is sharing the package cache from the
1480 host into the container to allow speeding up builds.
1481
1482
1483 Note:
1484
1485
1486 - The `O` flag conflicts with other options listed above.
1487
1488
1489
1490 Content mounted into the container is labeled with the private label.
1491 On SELinux systems, labels in the source directory must be read‐
1492 able by the container label. Usually containers can read/execute con‐
1493 tainer_share_t and can read/write container_file_t. If you can not
1494 change the labels on a source volume, SELinux container separation must
1495 be disabled for the container to work.
1496 - The source directory mounted into the container with an overlay
1497 mount should not be modified, it can cause unexpected failures. It is
1498 recommended that you do not modify the directory until the container
1499 finishes running.
1500
1501
1502 Mounts propagation
1503
1504
1505 By default bind mounted volumes are private. That means any mounts done
1506 inside container will not be visible on host and vice versa. One can
1507 change this behavior by specifying a volume mount propagation property.
1508 Making a volume shared mounts done under that volume inside container
1509 will be visible on host and vice versa. Making a volume slave enables
1510 only one way mount propagation and that is mounts done on host under
1511 that volume will be visible inside container but not the other way
1512 around. [1] ⟨#Footnote1⟩
1513
1514
1515 To control mount propagation property of a volume one can use the
1516 [r]shared, [r]slave, [r]private or the [r]unbindable propagation flag.
1517 Propagation property can be specified only for bind mounted volumes and
1518 not for internal volumes or named volumes. For mount propagation to
1519 work the source mount point (the mount point where source dir is
1520 mounted on) has to have the right propagation properties. For shared
1521 volumes, the source mount point has to be shared. And for slave vol‐
1522 umes, the source mount point has to be either shared or slave. [1]
1523 ⟨#Footnote1⟩
1524
1525
1526 If you want to recursively mount a volume and all of its submounts into
1527 a container, then you can use the rbind option. By default the bind
1528 option is used, and submounts of the source directory will not be
1529 mounted into the container.
1530
1531
1532 Mounting the volume with the nosuid options means that SUID applica‐
1533 tions on the volume will not be able to change their privilege. By
1534 default volumes are mounted with nosuid.
1535
1536
1537 Mounting the volume with the noexec option means that no executables on
1538 the volume will be able to executed within the container.
1539
1540
1541 Mounting the volume with the nodev option means that no devices on the
1542 volume will be able to be used by processes within the container. By
1543 default volumes are mounted with nodev.
1544
1545
1546 If the is a mount point, then "dev", "suid", and "exec" options are
1547 ignored by the kernel.
1548
1549
1550 Use df <source-dir> to figure out the source mount and then use findmnt
1551 -o TARGET,PROPAGATION <source-mount-dir> to figure out propagation
1552 properties of source mount. If findmnt utility is not available, then
1553 one can look at mount entry for source mount point in
1554 /proc/self/mountinfo. Look at optional fields and see if any propaga‐
1555 tion properties are specified. shared:X means mount is shared, mas‐
1556 ter:X means mount is slave and if nothing is there that means mount is
1557 private. [1] ⟨#Footnote1⟩
1558
1559
1560 To change propagation properties of a mount point use mount command.
1561 For example, if one wants to bind mount source directory /foo one can
1562 do mount --bind /foo /foo and mount --make-private --make-shared /foo.
1563 This will convert /foo into a shared mount point. Alternatively one can
1564 directly change propagation properties of source mount. Say / is source
1565 mount for /foo, then use mount --make-shared / to convert / into a
1566 shared mount.
1567
1568
1569 --volumes-from[=CONTAINER[:OPTIONS]]
1570 Mount volumes from the specified container(s). Used to share volumes
1571 between containers. The options is a comma delimited list with the fol‐
1572 lowing available elements:
1573
1574
1575 · rw|ro
1576
1577 · z
1578
1579
1580
1581 Mounts already mounted volumes from a source container onto another
1582 container. You must supply the source's container-id or container-name.
1583 To share a volume, use the --volumes-from option when running the tar‐
1584 get container. You can share volumes even if the source container is
1585 not running.
1586
1587
1588 By default, Podman mounts the volumes in the same mode (read-write or
1589 read-only) as it is mounted in the source container. You can change
1590 this by adding a ro or rw option.
1591
1592
1593 Labeling systems like SELinux require that proper labels are placed on
1594 volume content mounted into a container. Without a label, the security
1595 system might prevent the processes running inside the container from
1596 using the content. By default, Podman does not change the labels set by
1597 the OS.
1598
1599
1600 To change a label in the container context, you can add z to the volume
1601 mount. This suffix tells Podman to relabel file objects on the shared
1602 volumes. The z option tells Podman that two containers share the volume
1603 content. As a result, Podman labels the content with a shared content
1604 label. Shared volume labels allow all containers to read/write content.
1605
1606
1607 If the location of the volume from the source container overlaps with
1608 data residing on a target container, then the volume hides that data on
1609 the target.
1610
1611
1612 --workdir, -w=dir
1613 Working directory inside the container
1614
1615
1616 The default working directory for running binaries within a container
1617 is the root directory (/). The image developer can set a different
1618 default with the WORKDIR instruction. The operator can override the
1619 working directory by using the -w option.
1620
1621
1623 Create a container using a local image
1624 $ podman create alpine ls
1625
1626
1627
1628 Create a container using a local image and annotate it
1629 $ podman create --annotation HELLO=WORLD alpine ls
1630
1631
1632
1633 Create a container using a local image, allocating a pseudo-TTY, keeping
1634 stdin open and name it myctr
1635 podman create -t -i --name myctr alpine ls
1636
1637
1638
1639 Set UID/GID mapping in a new user namespace
1640 Running a container in a new user namespace requires a mapping of the
1641 uids and gids from the host.
1642
1643
1644 $ podman create --uidmap 0:30000:7000 --gidmap 0:30000:7000 fedora echo hello
1645
1646
1647
1648 Configure timezone in a container
1649 $ podman create --tz=local alpine date
1650 $ podman create --tz=Asia/Shanghai alpine date
1651 $ podman create --tz=US/Eastern alpine date
1652
1653
1654
1655 Rootless Containers
1656 Podman runs as a non root user on most systems. This feature requires
1657 that a new enough version of shadow-utils be installed. The
1658 shadow-utils package must include the newuidmap and newgidmap executa‐
1659 bles.
1660
1661
1662 Note: RHEL7 and Centos 7 will not have this feature until RHEL7.7 is
1663 released.
1664
1665
1666 In order for users to run rootless, there must be an entry for their
1667 username in /etc/subuid and /etc/subgid which lists the UIDs for their
1668 user namespace.
1669
1670
1671 Rootless Podman works better if the fuse-overlayfs and slirp4netns
1672 packages are installed. The fuse-overlay package provides a userspace
1673 overlay storage driver, otherwise users need to use the vfs storage
1674 driver, which is diskspace expensive and does not perform well.
1675 slirp4netns is required for VPN, without it containers need to be run
1676 with the --network=host flag.
1677
1678
1680 Environment variables within containers can be set using multiple dif‐
1681 ferent options: This section describes the precedence.
1682
1683
1684 Precedence order (later entries override earlier entries):
1685
1686
1687 · --env-host : Host environment of the process executing Podman
1688 is added.
1689
1690 · --http-proxy: By default, several environment variables will
1691 be passed in from the host, such as http_proxy and no_proxy.
1692 See --http-proxy for details.
1693
1694 · Container image : Any environment variables specified in the
1695 container image.
1696
1697 · --env-file : Any environment variables specified via
1698 env-files. If multiple files specified, then they override
1699 each other in order of entry.
1700
1701 · --env : Any environment variables specified will override pre‐
1702 vious settings.
1703
1704
1705
1706 Create containers and set the environment ending with a * and a *****
1707
1708
1709 $ export ENV1=a
1710 $ podman create --name ctr --env ENV* alpine printenv ENV1
1711 $ podman start --attach ctr
1712 a
1713
1714 $ podman create --name ctr --env ENV*****=b alpine printenv ENV*****
1715 $ podman start --attach ctr
1716 b
1717
1718
1719
1721 /etc/subuid /etc/subgid
1722
1723
1724 NOTE: Use the environment variable TMPDIR to change the temporary stor‐
1725 age location of downloaded container images. Podman defaults to use
1726 /var/tmp.
1727
1728
1730 podman(1), podman-save(1), podman-ps(1), podman-attach(1), pod‐
1731 man-pod-create(1), podman-port(1), podman-kill(1), podman-stop(1), pod‐
1732 man-generate-systemd(1) podman-rm(1), subgid(5), subuid(5), contain‐
1733 ers.conf(5), systemd.unit(5), setsebool(8), slirp4netns(1), fuse-over‐
1734 layfs(1), proc(5)**.
1735
1736
1738 October 2017, converted from Docker documentation to Podman by Dan
1739 Walsh for Podman dwalsh@redhat.com ⟨mailto:dwalsh@redhat.com⟩
1740
1741
1742 November 2014, updated by Sven Dowideit SvenDowideit@home.org.au
1743 ⟨mailto:SvenDowideit@home.org.au⟩
1744
1745
1746 September 2014, updated by Sven Dowideit SvenDowideit@home.org.au
1747 ⟨mailto:SvenDowideit@home.org.au⟩
1748
1749
1750 August 2014, updated by Sven Dowideit SvenDowideit@home.org.au
1751 ⟨mailto:SvenDowideit@home.org.au⟩
1752
1753
1755 1: The Podman project is committed to inclusivity, a core value of open
1756 source. The master and slave mount propagation terminology used here is
1757 problematic and divisive, and should be changed. However, these terms
1758 are currently used within the Linux kernel and must be used as-is at
1759 this time. When the kernel maintainers rectify this usage, Podman will
1760 follow suit immediately.
1761
1762
1763
1764 podman-create(1)()