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
29 --add-host=host
30
31
32 Add a custom host-to-IP mapping (host:ip)
33
34
35 Add a line to /etc/hosts. The format is hostname:ip. The --add-host
36 option can be set multiple times.
37
38
39 --annotation=key=value
40
41
42 Add an annotation to the container. The format is key=value. The
43 --annotation option can be set multiple times.
44
45
46 --attach, -a=location
47
48
49 Attach to STDIN, STDOUT or STDERR.
50
51
52 In foreground mode (the default when -d is not specified), podman run
53 can start the process in the container and attach the console to the
54 process's standard input, output, and standard error. It can even pre‐
55 tend to be a TTY (this is what most commandline executables expect) and
56 pass along signals. The -a option can be set for each of stdin, stdout,
57 and stderr.
58
59
60 --authfile=path
61
62
63 Path of the authentication file. Default is ${XDG_\RUNTIME_DIR}/con‐
64 tainers/auth.json
65
66
67 Note: You can also override the default path of the authentication file
68 by setting the REGISTRY_AUTH_FILE environment variable. export REG‐
69 ISTRY_AUTH_FILE=path (Not available for remote commands)
70
71
72 --blkio-weight=weight
73
74
75 Block IO weight (relative weight) accepts a weight value between 10 and
76 1000.
77
78
79 --blkio-weight-device=weight
80
81
82 Block IO weight (relative device weight, format: DEVICE_NAME:WEIGHT).
83
84
85 --cap-add=capability
86
87
88 Add Linux capabilities
89
90
91 --cap-drop=capability
92
93
94 Drop Linux capabilities
95
96
97 --cgroupns=mode
98
99
100 Set the cgroup namespace mode for the container, by default host is
101 used.
102 host: use the host's cgroup namespace inside the container.
103 container:: join the namespace of the specified container.
104 private: create a new cgroup namespace.
105 ns:: join the namespace at the specified path.
106
107
108 --cgroups=mode
109
110
111 Determines whether the container will create CGroups. Valid values are
112 enabled and disabled, which the default being enabled. The disabled
113 option will force the container to not create CGroups, and thus con‐
114 flicts with CGroup options (--cgroupns and --cgroup-parent).
115
116
117 --cgroup-parent=path
118
119
120 Path to cgroups under which the cgroup for the container will be cre‐
121 ated. If the path is not absolute, the path is considered to be rela‐
122 tive to the cgroups path of the init process. Cgroups will be created
123 if they do not already exist.
124
125
126 --cidfile=id
127
128
129 Write the container ID to the file
130
131
132 --conmon-pidfile=path
133
134
135 Write the pid of the conmon process to a file. conmon runs in a sepa‐
136 rate process than Podman, so this is necessary when using systemd to
137 restart Podman containers.
138
139
140 --cpu-count=limit
141
142
143 Limit the number of CPUs available for execution by the container.
144
145
146 On Windows Server containers, this is approximated as a percentage of
147 total CPU usage.
148
149
150 On Windows Server containers, the processor resource controls are mutu‐
151 ally exclusive, the order of precedence is CPUCount first, then
152 CPUShares, and CPUPercent last.
153
154
155 --cpu-period=limit
156
157
158 Limit the CPU CFS (Completely Fair Scheduler) period
159
160
161 Limit the container's CPU usage. This flag tell the kernel to restrict
162 the container's CPU usage to the period you specify.
163
164
165 --cpu-quota=limit
166
167
168 Limit the CPU CFS (Completely Fair Scheduler) quota
169
170
171 Limit the container's CPU usage. By default, containers run with the
172 full CPU resource. This flag tell the kernel to restrict the con‐
173 tainer's CPU usage to the quota you specify.
174
175
176 --cpu-rt-period=microseconds
177
178
179 Limit the CPU real-time period in microseconds
180
181
182 Limit the container's Real Time CPU usage. This flag tell the kernel to
183 restrict the container's Real Time CPU usage to the period you specify.
184
185
186 --cpu-rt-runtime=microseconds
187
188
189 Limit the CPU real-time runtime in microseconds
190
191
192 Limit the containers Real Time CPU usage. This flag tells the kernel to
193 limit the amount of time in a given CPU period Real Time tasks may con‐
194 sume. Ex: Period of 1,000,000us and Runtime of 950,000us means that
195 this container could consume 95% of available CPU and leave the remain‐
196 ing 5% to normal priority tasks.
197
198
199 The sum of all runtimes across containers cannot exceed the amount
200 allotted to the parent cgroup.
201
202
203 --cpu-shares=shares
204
205
206 CPU shares (relative weight)
207
208
209 By default, all containers get the same proportion of CPU cycles. This
210 proportion can be modified by changing the container's CPU share
211 weighting relative to the weighting of all other running containers.
212
213
214 To modify the proportion from the default of 1024, use the --cpu-shares
215 flag to set the weighting to 2 or higher.
216
217
218 The proportion will only apply when CPU-intensive processes are run‐
219 ning. When tasks in one container are idle, other containers can use
220 the left-over CPU time. The actual amount of CPU time will vary depend‐
221 ing on the number of containers running on the system.
222
223
224 For example, consider three containers, one has a cpu-share of 1024 and
225 two others have a cpu-share setting of 512. When processes in all three
226 containers attempt to use 100% of CPU, the first container would
227 receive 50% of the total CPU time. If you add a fourth container with a
228 cpu-share of 1024, the first container only gets 33% of the CPU. The
229 remaining containers receive 16.5%, 16.5% and 33% of the CPU.
230
231
232 On a multi-core system, the shares of CPU time are distributed over all
233 CPU cores. Even if a container is limited to less than 100% of CPU
234 time, it can use 100% of each individual CPU core.
235
236
237 For example, consider a system with more than three cores. If you start
238 one container {C0} with -c=512 running one process, and another con‐
239 tainer {C1} with -c=1024 running two processes, this can result in the
240 following division of CPU shares:
241
242
243 PID container CPU CPU share 100 {C0} 0 100% of
244 CPU0 101 {C1} 1 100% of CPU1 102
245 {C1} 2 100% of CPU2
246
247
248 --cpus=number
249
250
251 Number of CPUs. The default is 0.0 which means no limit.
252
253
254 --cpuset-cpus=cpus
255
256
257 CPUs in which to allow execution (0-3, 0,1)
258
259
260 --cpuset-mems=nodes
261
262
263 Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effec‐
264 tive on NUMA systems.
265
266
267 If you have four memory nodes on your system (0-3), use
268 --cpuset-mems=0,1 then processes in your container will only use memory
269 from the first two memory nodes.
270
271
272 --detach, -d=true|false
273
274
275 Detached mode: run the container in the background and print the new
276 container ID. The default is false.
277
278
279 At any time you can run podman ps in the other shell to view a list of
280 the running containers. You can reattach to a detached container with
281 podman attach.
282
283
284 When attached in the tty mode, you can detach from the container (and
285 leave it running) using a configurable key sequence. The default
286 sequence is ctrl-p,ctrl-q. Configure the keys sequence using the
287 --detach-keys option, or specifying it in the libpod.conf file: see
288 libpod.conf(5) for more information.
289
290
291 --detach-keys=sequence
292
293
294 Override the key sequence for detaching a container. Format is a single
295 character [a-Z] or a comma separated sequence of ctrl-<value>, where
296 <value> is one of: a-z, @, ^, [, \\, ], ^ or _.
297
298
299 --device=device
300
301
302 Add a host device to the container. The format is
303 <device-on-host>[:<device-on-container>][:<permissions>] (e.g.
304 --device=/dev/sdc:/dev/xvdc:rwm)
305
306
307 --device-read-bps=path
308
309
310 Limit read rate (bytes per second) from a device (e.g.
311 --device-read-bps=/dev/sda:1mb)
312
313
314 --device-read-iops=path
315
316
317 Limit read rate (IO per second) from a device (e.g.
318 --device-read-iops=/dev/sda:1000)
319
320
321 --device-write-bps=path
322
323
324 Limit write rate (bytes per second) to a device (e.g.
325 --device-write-bps=/dev/sda:1mb)
326
327
328 --device-write-iops=path
329
330
331 Limit write rate (IO per second) to a device (e.g.
332 --device-write-iops=/dev/sda:1000)
333
334
335 --dns=dns
336
337
338 Set custom DNS servers. Invalid if using --dns and --network that is
339 set to 'none' or 'container:'.
340
341
342 This option can be used to override the DNS configuration passed to the
343 container. Typically this is necessary when the host DNS configuration
344 is invalid for the container (e.g., 127.0.0.1). When this is the case
345 the --dns flags is necessary for every run.
346
347
348 The special value none can be specified to disable creation of
349 /etc/resolv.conf in the container by Podman. The /etc/resolv.conf file
350 in the image will be used without changes.
351
352
353 --dns-option=option
354
355
356 Set custom DNS options. Invalid if using --dns-option and --network
357 that is set to 'none' or 'container:'.
358
359
360 --dns-search=domain
361
362
363 Set custom DNS search domains. Invalid if using --dns-search and --net‐
364 work that is set to 'none' or 'container:'. (Use --dns-search=. if you
365 don't wish to set the search domain)
366
367
368 --entrypoint="command" | '["command", "arg1", ...]'
369
370
371 Overwrite the default ENTRYPOINT of the image
372
373
374 This option allows you to overwrite the default entrypoint of the
375 image. The ENTRYPOINT of an image is similar to a COMMAND because it
376 specifies what executable to run when the container starts, but it is
377 (purposely) more difficult to override. The ENTRYPOINT gives a con‐
378 tainer its default nature or behavior, so that when you set an ENTRY‐
379 POINT you can run the container as if it were that binary, complete
380 with default options, and you can pass in more options via the COMMAND.
381 But, sometimes an operator may want to run something else inside the
382 container, so you can override the default ENTRYPOINT at runtime by
383 using a --entrypoint and a string to specify the new ENTRYPOINT.
384
385
386 You need to specify multi option commands in the form of a json string.
387
388
389 --env, -e=env
390
391
392 Set environment variables
393
394
395 This option allows arbitrary environment variables that are available
396 for the process to be launched inside of the container. If an environ‐
397 ment variable is specified without a value, Podman will check the host
398 environment for a value and set the variable only if it is set on the
399 host. If an environment variable ending in * is specified, Podman will
400 search the host environment for variables starting with the prefix and
401 will add those variables to the container. If an environment variable
402 with a trailing ***** is specified, then a value must be supplied.
403
404
405 See Environment ⟨#environment⟩ note below for precedence and examples.
406
407
408 --env-host=true|false
409
410
411 Use host environment inside of the container. See Environment note
412 below for precedence.
413
414
415 --env-file=file
416
417
418 Read in a line delimited file of environment variables. See Environment
419 note below for precedence.
420
421
422 --expose=port
423
424
425 Expose a port, or a range of ports (e.g. --expose=3300-3310) to set up
426 port redirection on the host system.
427
428
429 --gidmap=container_gid:host_gid:amount
430
431
432 GID map for the user namespace. Using this flag will run the container
433 with user namespace enabled. It conflicts with the --userns and --sub‐
434 gidname flags.
435
436
437 The following example maps uids 0-2000 in the container to the uids
438 30000-31999 on the host and gids 0-2000 in the container to the gids
439 30000-31999 on the host. --gidmap=0:30000:2000
440
441
442 --group-add=group
443
444
445 Add additional groups to run as
446
447
448 --health-cmd="command" | '["command", "arg1", ...]'
449
450
451 Set or alter a healthcheck command for a container. The command is a
452 command to be executed inside your container that determines your con‐
453 tainer health. The command is required for other healthcheck options
454 to be applied. A value of none disables existing healthchecks.
455
456
457 Multiple options can be passed in the form of a JSON array; otherwise,
458 the command will be interpreted as an argument to /bin/sh -c.
459
460
461 --health-interval=interval
462
463
464 Set an interval for the healthchecks (a value of disable results in no
465 automatic timer setup) (default "30s")
466
467
468 --health-retries=retries
469
470
471 The number of retries allowed before a healthcheck is considered to be
472 unhealthy. The default value is 3.
473
474
475 --health-start-period=period
476
477
478 The initialization time needed for a container to bootstrap. The value
479 can be expressed in time format like 2m3s. The default value is 0s
480
481
482 --health-timeout=timeout
483
484
485 The maximum time allowed to complete the healthcheck before an interval
486 is considered failed. Like start-period, the value can be expressed in
487 a time format such as 1m22s. The default value is 30s.
488
489
490 --hostname=name
491
492
493 Container host name
494
495
496 Sets the container host name that is available inside the container.
497
498
499 --help
500
501
502 Print usage statement
503
504
505 --http-proxy=true|false
506
507
508 By default proxy environment variables are passed into the container if
509 set for the Podman process. This can be disabled by setting the
510 --http-proxy option to false. The environment variables passed in
511 include http_proxy, https_proxy, ftp_proxy, no_proxy, and also the
512 upper case versions of those. This option is only needed when the host
513 system must use a proxy but the container should not use any proxy.
514 Proxy environment variables specified for the container in any other
515 way will override the values that would have been passed thru from the
516 host. (Other ways to specify the proxy for the container include pass‐
517 ing the values with the --env flag, or hard coding the proxy environ‐
518 ment at container build time.)
519
520
521 For example, to disable passing these environment variables from host
522 to container:
523
524
525 --http-proxy=false
526
527
528 Defaults to true
529
530
531 --image-volume, builtin-volume=bind|tmpfs|ignore
532
533
534 Tells Podman how to handle the builtin image volumes. The options are:
535 'bind', 'tmpfs', or 'ignore' (default 'bind'). bind: A directory is
536 created inside the container state directory and bind mounted into the
537 container for the volumes. tmpfs: The volume is mounted onto the con‐
538 tainer as a tmpfs, which allows the users to create content that disap‐
539 pears when the container is stopped. ignore: All volumes are just
540 ignored and no action is taken.
541
542
543 --init
544
545
546 Run an init inside the container that forwards signals and reaps pro‐
547 cesses.
548
549
550 --init-path=path
551
552
553 Path to the container-init binary.
554
555
556 --interactive, i=true|false
557
558
559 Keep STDIN open even if not attached. The default is false.
560
561
562 --ip6=ip
563
564
565 Not implemented
566
567
568 --ip=ip
569
570
571 Specify a static IP address for the container, for example
572 '10.88.64.128'. Can only be used if no additional CNI networks to join
573 were specified via '--network=', and if the container is not joining
574 another container's network namespace via '--network=container:'. The
575 address must be within the default CNI network's pool (default
576 10.88.0.0/16).
577
578
579 --ipc=ipc
580
581
582 Default is to create a private IPC namespace (POSIX SysV IPC) for the
583 container
584 'container:': reuses another container shared memory,
585 semaphores and message queues
586 'host': use the host shared memory,semaphores and mes‐
587 sage queues inside the container. Note: the host mode gives the con‐
588 tainer full access to local shared memory and is therefore considered
589 insecure.
590 'ns:' path to an IPC namespace to join.
591
592
593 --kernel-memory=number[unit]
594
595
596 Kernel memory limit (format: <number>[<unit>], where unit = b (bytes),
597 k (kilobytes), m (megabytes), or g (gigabytes))
598
599
600 Constrains the kernel memory available to a container. If a limit of 0
601 is specified (not using --kernel-memory), the container's kernel memory
602 is not limited. If you specify a limit, it may be rounded up to a mul‐
603 tiple of the operating system's page size and the value can be very
604 large, millions of trillions.
605
606
607 --label, -l=label
608
609
610 Add metadata to a container (e.g., --label com.example.key=value)
611
612
613 --label-file=file
614
615
616 Read in a line delimited file of labels
617
618
619 --link-local-ip=ip
620
621
622 Not implemented
623
624
625 --log-driver="k8s-file"
626
627
628 Logging driver for the container. Currently available options are
629 k8s-file and journald, with json-file aliased to k8s-file for scripting
630 compatibility.
631
632
633 --log-opt=path
634
635
636 Logging driver specific options. Used to set the path to the container
637 log file. For example:
638
639
640 --log-opt path=/var/log/container/mycontainer.json
641
642
643 --mac-address=address
644
645
646 Container MAC address (e.g. 92:d0:c6:0a:29:33)
647
648
649 Remember that the MAC address in an Ethernet network must be unique.
650 The IPv6 link-local address will be based on the device's MAC address
651 according to RFC4862.
652
653
654 Not currently supported
655
656
657 --memory, -m=limit
658
659
660 Memory limit (format: [], where unit = b (bytes), k (kilobytes), m
661 (megabytes), or g (gigabytes))
662
663
664 Allows you to constrain the memory available to a container. If the
665 host supports swap memory, then the -m memory setting can be larger
666 than physical RAM. If a limit of 0 is specified (not using -m), the
667 container's memory is not limited. The actual limit may be rounded up
668 to a multiple of the operating system's page size (the value would be
669 very large, that's millions of trillions).
670
671
672 --memory-reservation=limit
673
674
675 Memory soft limit (format: [], where unit = b (bytes), k (kilobytes), m
676 (megabytes), or g (gigabytes))
677
678
679 After setting memory reservation, when the system detects memory con‐
680 tention or low memory, containers are forced to restrict their consump‐
681 tion to their reservation. So you should always set the value below
682 --memory, otherwise the hard limit will take precedence. By default,
683 memory reservation will be the same as memory limit.
684
685
686 --memory-swap=limit
687
688
689 A limit value equal to memory plus swap. Must be used with the -m
690 (--memory) flag. The swap LIMIT should always be larger than -m (--mem‐
691 ory) value. By default, the swap LIMIT will be set to double the value
692 of --memory.
693
694
695 The format of LIMIT is <number>[<unit>]. Unit can be b (bytes), k
696 (kilobytes), m (megabytes), or g (gigabytes). If you don't specify a
697 unit, b is used. Set LIMIT to -1 to enable unlimited swap.
698
699
700 --memory-swappiness=number
701
702
703 Tune a container's memory swappiness behavior. Accepts an integer
704 between 0 and 100.
705
706
707 --mount=type=TYPE,TYPE-SPECIFIC-OPTION[,...]
708
709
710 Attach a filesystem mount to the container
711
712
713 Current supported mount TYPES are bind, volume, and tmpfs.
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 Common Options:
727
728 · src, source: mount source spec for bind and volume. Mandatory for bind.
729
730 · dst, destination, target: mount destination spec.
731
732 · ro, read-only: true or false (default).
733
734 Options specific to bind:
735
736 · bind-propagation: shared, slave, private, rshared, rslave, or rprivate(default). See also mount(2).
737
738 . bind-nonrecursive: do not setup a recursive bind mount. By default it is recursive.
739
740 . relabel: shared, private.
741
742 Options specific to tmpfs:
743
744 · tmpfs-size: Size of the tmpfs mount in bytes. Unlimited by default in Linux.
745
746 · tmpfs-mode: File mode of the tmpfs in octal. (e.g. 700 or 0700.) Defaults to 1777 in Linux.
747
748
749
750 --name=name
751
752
753 Assign a name to the container
754
755
756 The operator can identify a container in three ways: UUID long identi‐
757 fier
758 (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”)
759 UUID short identifier (“f78375b1c487”) Name (“jonah”)
760
761
762 podman generates a UUID for each container, and if a name is not
763 assigned to the container with --name then it will generate a random
764 string name. The name is useful any place you need to identify a con‐
765 tainer. This works for both background and foreground containers.
766
767
768 --network, --net="bridge"
769
770
771 Set the Network mode for the container. Invalid if using --dns,
772 --dns-option, or --dns-search with --network that is set to 'none' or
773 'container:'.
774 'bridge': create a network stack on the default bridge
775 'none': no networking
776 'container:': reuse another container's network stack
777 'host': use the Podman host network stack. Note: the
778 host mode gives the container full access to local system services such
779 as D-bus and is therefore considered insecure.
780 '|': connect to a user-defined network
781 'ns:': path to a network namespace to join
782 'slirp4netns': use slirp4netns to create a user network
783 stack. This is the default for rootless containers
784
785
786 --network-alias=alias
787
788
789 Not implemented
790
791
792 --no-hosts=true|false
793
794
795 Do not create /etc/hosts for the container. By default, Podman will
796 manage /etc/hosts, adding the container's own IP address and any hosts
797 from --add-host. --no-hosts disables this, and the image's /etc/host
798 will be preserved unmodified. This option conflicts with --add-host.
799
800
801 --oom-kill-disable=true|false
802
803
804 Whether to disable OOM Killer for the container or not.
805
806
807 --oom-score-adj=num
808
809
810 Tune the host's OOM preferences for containers (accepts -1000 to 1000)
811
812
813 --pid=pid
814
815
816 Set the PID mode for the container Default is to create a private PID
817 namespace for the container
818 'container:': join another container's PID namespace
819 'host': use the host's PID namespace for the container.
820 Note: the host mode gives the container full access to local PID and is
821 therefore considered insecure.
822 'ns': join the specified PID namespace
823
824
825 --pids-limit=limit
826
827
828 Tune the container's pids limit. Set 0 to have unlimited pids for the
829 container. (default "4096" on systems that support PIDS cgroups).
830
831
832 --pod=name
833
834
835 Run container in an existing pod. If you want Podman to make the pod
836 for you, preference the pod name with new:. To make a pod with more
837 granular options, use the podman pod create command before creating a
838 container.
839
840
841 --privileged=true|false
842
843
844 Give extended privileges to this container. The default is false.
845
846
847 By default, Podman containers are “unprivileged” (=false) and cannot,
848 for example, modify parts of the kernel. This is because by default a
849 container is not allowed to access any devices. A “privileged” con‐
850 tainer is given access to all devices.
851
852
853 When the operator executes a privileged container, Podman enables
854 access to all devices on the host, turns off graphdriver mount options,
855 as well as turning off most of the security measures protecting the
856 host from the container.
857
858
859 --publish, -p=port
860
861
862 Publish a container's port, or range of ports, to the host
863
864
865 Format: ip:hostPort:containerPort | ip::containerPort | hostPort:con‐
866 tainerPort | containerPort Both hostPort and containerPort can be spec‐
867 ified as a range of ports. When specifying ranges for both, the number
868 of container ports in the range must match the number of host ports in
869 the range. (e.g., podman run -p 1234-1236:1222-1224 --name thisWorks
870 -t busybox but not podman run -p 1230-1236:1230-1240 --name RangeCon‐
871 tainerPortsBiggerThanRangeHostPorts -t busybox) With ip: podman run -p
872 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage Use
873 podman port to see the actual mapping: podman port CONTAINER $CONTAIN‐
874 ERPORT
875
876
877 --publish-all, -P=true|false
878
879
880 Publish all exposed ports to random ports on the host interfaces. The
881 default is false.
882
883
884 When set to true publish all exposed ports to the host interfaces. The
885 default is false. If the operator uses -P (or -p) then Podman will make
886 the exposed port accessible on the host and the ports will be available
887 to any client that can reach the host. When using -P, Podman will bind
888 any exposed port to a random port on the host within an ephemeral port
889 range defined by /proc/sys/net/ipv4/ip_local_port_range. To find the
890 mapping between the host ports and the exposed ports, use podman port.
891
892
893 --pull=missing
894
895
896 Pull image before creating ("always"|"missing"|"never") (default "miss‐
897 ing").
898 'missing': default value, attempt to pull the latest image from
899 the registries listed in registries.conf if a local image does not
900 exist.Raise an error if the image is not in any listed registry and is
901 not present locally.
902 'always': Pull the image from the first registry it is found in
903 as listed in registries.conf. Raise an error if not found in the reg‐
904 istries, even if the image is present locally.
905 'never': do not pull the image from the registry, use only the
906 local version. Raise an error if the image is not present locally.
907
908
909 Defaults to missing.
910
911
912 --quiet, -q
913
914
915 Suppress output information when pulling images
916
917
918 --read-only=true|false
919
920
921 Mount the container's root filesystem as read only.
922
923
924 By default a container will have its root filesystem writable allowing
925 processes to write files anywhere. By specifying the --read-only flag
926 the container will have its root filesystem mounted as read only pro‐
927 hibiting any writes.
928
929
930 --read-only-tmpfs=true|false
931
932
933 If container is running in --read-only mode, then mount a read-write
934 tmpfs on /run, /tmp, and /var/tmp. The default is true
935
936
937 --restart=policy
938
939
940 Restart policy to follow when containers exit. Restart policy will not
941 take effect if a container is stopped via the podman kill or podman
942 stop commands. Valid values are:
943
944
945 · no : Do not restart containers on exit
946
947 · on-failure[:max_retries] : Restart containers when they exit
948 with a non-0 exit code, retrying indefinitely or until the
949 optional max_retries count is hit
950
951 · always : Restart containers when they exit,
952 regardless of status, retrying indefinitely
953
954
955
956 Please note that restart will not restart containers after a system
957 reboot. If this functionality is required in your environment, you can
958 invoke Podman from a systemd unit file, or create an init script for
959 whichever init system is in use. To generate systemd unit files,
960 please see podman generate systemd
961
962
963 --rm=true|false
964
965
966 Automatically remove the container when it exits. The default is false.
967
968
969 Note that the container will not be removed when it could not be cre‐
970 ated or started successfully. This allows the user to inspect the con‐
971 tainer after failure.
972
973
974 --rootfs
975
976
977 If specified, the first argument refers to an exploded container on the
978 file system.
979
980
981 This is useful to run a container without requiring any image manage‐
982 ment, the rootfs of the container is assumed to be managed externally.
983
984
985 --security-opt=option
986
987
988 Security Options
989
990
991 · apparmor=unconfined : Turn off apparmor confinement for the
992 container
993
994 · apparmor=your-profile : Set the apparmor confinement profile
995 for the container
996
997 · label=user:USER : Set the label user for the container
998 processes
999
1000 · label=role:ROLE : Set the label role for the container
1001 processes
1002
1003 · label=type:TYPE : Set the label process type for the con‐
1004 tainer processes
1005
1006 · label=level:LEVEL : Set the label level for the container
1007 processes
1008
1009 · label=filetype:TYPE : Set the label file type for the con‐
1010 tainer files
1011
1012 · label=disable : Turn off label separation for the con‐
1013 tainer
1014
1015 · no-new-privileges : Disable container processes from gaining
1016 additional privileges
1017
1018 · seccomp=unconfined : Turn off seccomp confinement for the con‐
1019 tainer
1020
1021 · seccomp=profile.json : White listed syscalls seccomp Json
1022 file to be used as a seccomp filter
1023
1024
1025
1026 Note: Labeling can be disabled for all containers by setting
1027 label=false in the libpod.conf (/etc/containers/libpod.conf) file.
1028
1029
1030 --shm-size=size
1031
1032
1033 Size of /dev/shm (format: [], where unit = b (bytes), k (kilobytes), m
1034 (megabytes), or g (gigabytes)) If you omit the unit, the system uses
1035 bytes. If you omit the size entirely, the system uses 64m. When size
1036 is 0, there is no limit on the amount of memory used for IPC by the
1037 container.
1038
1039
1040 --stop-signal=SIGTERM
1041
1042
1043 Signal to stop a container. Default is SIGTERM.
1044
1045
1046 --stop-timeout=seconds
1047
1048
1049 Timeout (in seconds) to stop a container. Default is 10.
1050
1051
1052 --subgidname=name
1053
1054
1055 Name for GID map from the /etc/subgid file. Using this flag will run
1056 the container with user namespace enabled. This flag conflicts with
1057 --userns and --gidmap.
1058
1059
1060 --subuidname=name
1061
1062
1063 Name for UID map from the /etc/subuid file. Using this flag will run
1064 the container with user namespace enabled. This flag conflicts with
1065 --userns and --uidmap.
1066
1067
1068 --sysctl=SYSCTL
1069
1070
1071 Configure namespaced kernel parameters at runtime
1072
1073
1074 IPC Namespace - current sysctls allowed:
1075
1076
1077 kernel.msgmax, kernel.msgmnb, kernel.msgmni, kernel.sem, kernel.shmall,
1078 kernel.shmmax, kernel.shmmni, kernel.shm_rmid_forced Sysctls beginning
1079 with fs.mqueue.*
1080
1081
1082 Note: if you use the --ipc=host option these sysctls will not be
1083 allowed.
1084
1085
1086 Network Namespace - current sysctls allowed:
1087 Sysctls beginning with net.*
1088
1089
1090 Note: if you use the --network=host option these sysctls will not be
1091 allowed.
1092
1093
1094 --systemd=true|false|always
1095
1096
1097 Run container in systemd mode. The default is true.
1098
1099
1100 The value always enforces the systemd mode is enforced without looking
1101 at the executable name. Otherwise, if set to true and the command you
1102 are running inside the container is systemd, /usr/sbin/init or
1103 /sbin/init.
1104
1105
1106 If the command you are running inside of the container is systemd, Pod‐
1107 man will setup tmpfs mount points in the following directories:
1108
1109
1110 /run, /run/lock, /tmp, /sys/fs/cgroup/systemd, /var/lib/journal
1111
1112
1113 It will also set the default stop signal to SIGRTMIN+3.
1114
1115
1116 This allow systemd to run in a confined container without any modifica‐
1117 tions.
1118
1119
1120 Note: On SELinux systems, systemd attempts to write to the cgroup file
1121 system. Containers writing to the cgroup file system are denied by
1122 default. The container_manage_cgroup boolean must be enabled for this
1123 to be allowed on an SELinux separated system.
1124
1125
1126 setsebool -P container_manage_cgroup true
1127
1128
1129 --tmpfs=fs
1130
1131
1132 Create a tmpfs mount
1133
1134
1135 Mount a temporary filesystem (tmpfs) mount into a container, for exam‐
1136 ple:
1137
1138
1139 $ podman run -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image
1140
1141
1142 This command mounts a tmpfs at /tmp within the container. The sup‐
1143 ported mount options are the same as the Linux default mount flags. If
1144 you do not specify any options, the systems uses the following options:
1145 rw,noexec,nosuid,nodev.
1146
1147
1148 --tty, -t=true|false
1149
1150
1151 Allocate a pseudo-TTY. The default is false.
1152
1153
1154 When set to true Podman will allocate a pseudo-tty and attach to the
1155 standard input of the container. This can be used, for example, to run
1156 a throwaway interactive shell. The default is false.
1157
1158
1159 Note: The -t option is incompatible with a redirection of the Podman
1160 client standard input.
1161
1162
1163 --uidmap=container_uid:host_uid:amount
1164
1165
1166 UID map for the user namespace. Using this flag will run the container
1167 with user namespace enabled. It conflicts with the --userns and --sub‐
1168 uidname flags.
1169
1170
1171 The following example maps uids 0-2000 in the container to the uids
1172 30000-31999 on the host and gids 0-2000 in the container to the gids
1173 30000-31999 on the host. --uidmap=0:30000:2000
1174
1175
1176 --ulimit=option
1177
1178
1179 Ulimit options
1180
1181
1182 You can pass host to copy the current configuration from the host.
1183
1184
1185 --user, -u=user
1186
1187
1188 Sets the username or UID used and optionally the groupname or GID for
1189 the specified command.
1190
1191
1192 The followings examples are all valid: --user [user | user:group | uid
1193 | uid:gid | user:gid | uid:group ]
1194
1195
1196 Without this argument the command will be run as root in the container.
1197
1198
1199 --userns=host --userns=keep-id --userns=container:container
1200 --userns=ns:my_namespace
1201
1202
1203 Set the user namespace mode for the container. It defaults to the POD‐
1204 MAN_USERNS environment variable. An empty value means user namespaces
1205 are disabled.
1206
1207
1208 · host: run in the user namespace of the caller. This is the
1209 default if no user namespace options are set. The processes
1210 running in the container will have the same privileges on the
1211 host as any other process launched by the calling user.
1212
1213 · keep-id: creates a user namespace where the current rootless
1214 user's UID:GID are mapped to the same values in the container.
1215 This option is ignored for containers created by the root
1216 user.
1217
1218 · ns: run the container in the given existing user namespace.
1219
1220 · container: join the user namespace of the specified container.
1221
1222
1223
1224 This option is incompatible with --gidmap, --uidmap, --subuid and
1225 --subgid
1226
1227
1228 --uts=host
1229
1230
1231 Set the UTS mode for the container
1232 host: use the host's UTS namespace inside the container.
1233 ns: specify the user namespace to use.
1234 Note: the host mode gives the container access to changing the
1235 host's hostname and is therefore considered insecure.
1236
1237
1238 --volume, -v[=[HOST-DIR:CONTAINER-DIR[:OPTIONS]]]
1239
1240
1241 Create a bind mount. If you specify, -v /HOST-DIR:/CONTAINER-DIR, pod‐
1242 man bind mounts /HOST-DIR in the host to /CONTAINER-DIR in the podman
1243 container. The OPTIONS are a comma delimited list and can be:
1244
1245
1246 · [rw|ro]
1247
1248 · [z|Z]
1249
1250 · [[r]shared|[r]slave|[r]private]
1251
1252
1253
1254 The CONTAINER-DIR must be an absolute path such as /src/docs. The
1255 HOST-DIR must be an absolute path as well. Podman bind-mounts the
1256 HOST-DIR to the path you specify. For example, if you supply the /foo
1257 value, Podman creates a bind-mount.
1258
1259
1260 You can specify multiple -v options to mount one or more mounts to a
1261 container.
1262
1263
1264 You can add :ro or :rw suffix to a volume to mount it read-only or
1265 read-write mode, respectively. By default, the volumes are mounted
1266 read-write. See examples.
1267
1268
1269 Labeling systems like SELinux require that proper labels are placed on
1270 volume content mounted into a container. Without a label, the security
1271 system might prevent the processes running inside the container from
1272 using the content. By default, Podman does not change the labels set by
1273 the OS.
1274
1275
1276 To change a label in the container context, you can add either of two
1277 suffixes :z or :Z to the volume mount. These suffixes tell Podman to
1278 relabel file objects on the shared volumes. The z option tells Podman
1279 that two containers share the volume content. As a result, Podman
1280 labels the content with a shared content label. Shared volume labels
1281 allow all containers to read/write content. The Z option tells Podman
1282 to label the content with a private unshared label. Only the current
1283 container can use a private volume.
1284
1285
1286 By default bind mounted volumes are private. That means any mounts done
1287 inside container will not be visible on host and vice versa. One can
1288 change this behavior by specifying a volume mount propagation property.
1289 Making a volume shared mounts done under that volume inside container
1290 will be visible on host and vice versa. Making a volume slave enables
1291 only one way mount propagation and that is mounts done on host under
1292 that volume will be visible inside container but not the other way
1293 around.
1294
1295
1296 To control mount propagation property of volume one can use :[r]shared,
1297 :[r]slave or :[r]private propagation flag. Propagation property can be
1298 specified only for bind mounted volumes and not for internal volumes or
1299 named volumes. For mount propagation to work source mount point (mount
1300 point where source dir is mounted on) has to have right propagation
1301 properties. For shared volumes, source mount point has to be shared.
1302 And for slave volumes, source mount has to be either shared or slave.
1303
1304
1305 Use df <source-dir> to figure out the source mount and then use findmnt
1306 -o TARGET,PROPAGATION <source-mount-dir> to figure out propagation
1307 properties of source mount. If findmnt utility is not available, then
1308 one can look at mount entry for source mount point in
1309 /proc/self/mountinfo. Look at optional fields and see if any propaga‐
1310 tion properties are specified. shared:X means mount is shared, mas‐
1311 ter:X means mount is slave and if nothing is there that means mount is
1312 private.
1313
1314
1315 To change propagation properties of a mount point use mount command.
1316 For example, if one wants to bind mount source directory /foo one can
1317 do mount --bind /foo /foo and mount --make-private --make-shared /foo.
1318 This will convert /foo into a shared mount point. Alternatively one can
1319 directly change propagation properties of source mount. Say / is source
1320 mount for /foo, then use mount --make-shared / to convert / into a
1321 shared mount.
1322
1323
1324 --volumes-from[=CONTAINER[:OPTIONS]]
1325
1326
1327 Mount volumes from the specified container(s). OPTIONS is a comma
1328 delimited list with the following available elements:
1329
1330
1331 · [rw|ro]
1332
1333 · z
1334
1335
1336
1337 Mounts already mounted volumes from a source container onto another
1338 container. You must supply the source's container-id or container-name.
1339 To share a volume, use the --volumes-from option when running the tar‐
1340 get container. You can share volumes even if the source container is
1341 not running.
1342
1343
1344 By default, Podman mounts the volumes in the same mode (read-write or
1345 read-only) as it is mounted in the source container. Optionally, you
1346 can change this by suffixing the container-id with either the ro or rw
1347 keyword.
1348
1349
1350 Labeling systems like SELinux require that proper labels are placed on
1351 volume content mounted into a container. Without a label, the security
1352 system might prevent the processes running inside the container from
1353 using the content. By default, Podman does not change the labels set by
1354 the OS.
1355
1356
1357 To change a label in the container context, you can add z to the volume
1358 mount. This suffix tells Podman to relabel file objects on the shared
1359 volumes. The z option tells Podman that two containers share the volume
1360 content. As a result, podman labels the content with a shared content
1361 label. Shared volume labels allow all containers to read/write content.
1362
1363
1364 If the location of the volume from the source container overlaps with
1365 data residing on a target container, then the volume hides that data on
1366 the target.
1367
1368
1369 --workdir, -w=dir
1370
1371
1372 Working directory inside the container
1373
1374
1375 The default working directory for running binaries within a container
1376 is the root directory (/). The image developer can set a different
1377 default with the WORKDIR instruction. The operator can override the
1378 working directory by using the -w option.
1379
1380
1382 Create a container using a local image
1383 $ podman create alpine ls
1384
1385
1386
1387 Create a container using a local image and annotate it
1388 $ podman create --annotation HELLO=WORLD alpine ls
1389
1390
1391
1392 Create a container using a local image, allocating a pseudo-TTY, keeping
1393 stdin open and name it myctr
1394 podman create -t -i --name myctr alpine ls
1395
1396
1397
1398 Set UID/GID mapping in a new user namespace
1399 Running a container in a new user namespace requires a mapping of the
1400 uids and gids from the host.
1401
1402
1403 $ podman create --uidmap 0:30000:7000 --gidmap 0:30000:7000 fedora echo hello
1404
1405
1406
1407 Rootless Containers
1408 Podman runs as a non root user on most systems. This feature requires
1409 that a new enough version of shadow-utils be installed. The
1410 shadow-utils package must include the newuidmap and newgidmap executa‐
1411 bles.
1412
1413
1414 Note: RHEL7 and Centos 7 will not have this feature until RHEL7.7 is
1415 released.
1416
1417
1418 In order for users to run rootless, there must be an entry for their
1419 username in /etc/subuid and /etc/subgid which lists the UIDs for their
1420 user namespace.
1421
1422
1423 Rootless Podman works better if the fuse-overlayfs and slirp4netns
1424 packages are installed. The fuse-overlay package provides a userspace
1425 overlay storage driver, otherwise users need to use the vfs storage
1426 driver, which is diskspace expensive and does not perform well.
1427 slirp4netns is required for VPN, without it containers need to be run
1428 with the --net=host flag.
1429
1430
1432 Environment variables within containers can be set using multiple dif‐
1433 ferent options: This section describes the precedence.
1434
1435
1436 Precedence Order: --env-host : Host environment of the process
1437 executing Podman is added.
1438
1439
1440 Container image : Any environment variables specified in the container image.
1441
1442 **--env-file** : Any environment variables specified via env-files. If multiple files specified, then they override each other in order of entry.
1443
1444 **--env** : Any environment variables specified will override previous settings.
1445
1446
1447
1448 Create containers and set the environment ending with a * and a *****
1449
1450
1451 $ export ENV1=a
1452 $ podman create --name ctr --env ENV* alpine printenv ENV1
1453 $ podman start --attach ctr
1454 a
1455
1456 $ podman create --name ctr --env ENV*****=b alpine printenv ENV*****
1457 $ podman start --attach ctr
1458 b
1459
1460
1461
1463 /etc/subuid /etc/subgid
1464
1465
1467 subgid(5), subuid(5), libpod.conf(5), systemd.unit(5), setsebool(8),
1468 slirp4netns(1), fuse-overlayfs(1)
1469
1470
1472 October 2017, converted from Docker documentation to Podman by Dan
1473 Walsh for Podman dwalsh@redhat.com ⟨mailto:dwalsh@redhat.com⟩
1474
1475
1476 November 2014, updated by Sven Dowideit SvenDowideit@home.org.au
1477 ⟨mailto:SvenDowideit@home.org.au⟩
1478
1479
1480 September 2014, updated by Sven Dowideit SvenDowideit@home.org.au
1481 ⟨mailto:SvenDowideit@home.org.au⟩
1482
1483
1484 August 2014, updated by Sven Dowideit SvenDowideit@home.org.au
1485 ⟨mailto:SvenDowideit@home.org.au⟩
1486
1487
1488
1489 podman-create(1)()