1podman-build(1)             General Commands Manual            podman-build(1)
2
3
4

NAME

6       podman-build - Build a container image using a Dockerfile
7
8

SYNOPSIS

10       podman build [options] context
11
12

DESCRIPTION

14       podman build Builds an image using instructions from one or more
15       Dockerfiles and a specified build context directory.
16
17
18       The build context directory can be specified as the http(s) URL of an
19       archive, git repository or Dockerfile.
20
21
22       Dockerfiles ending with a ".in" suffix will be preprocessed via CPP(1).
23       This can be useful to decompose Dockerfiles into several reusable parts
24       that can be used via CPP's #include directive.  Notice, a Dockerfile.in
25       file can still be used by other tools when manually preprocessing them
26       via cpp -E.
27
28
29       When the URL is an archive, the contents of the URL is downloaded to a
30       temporary location and extracted before execution.
31
32
33       When the URL is an Dockerfile, the Dockerfile is downloaded to a
34       temporary location.
35
36
37       When a Git repository is set as the URL, the repository is cloned
38       locally and then set as the context.
39
40

OPTIONS

42       --add-host=[]
43
44
45       Add a custom host-to-IP mapping (host:ip)
46
47
48       Add a line to /etc/hosts. The format is hostname:ip. The --add-host
49       option can be set multiple times.
50
51
52       --annotation annotation
53
54
55       Add an image annotation (e.g. annotation=value) to the image metadata.
56       Can be used multiple times.
57
58
59       Note: this information is not present in Docker image formats, so it is
60       discarded when writing images in Docker formats.
61
62
63       --authfile path
64
65
66       Path of the authentication file. Default is
67       ${XDG_RUNTIME_DIR}/containers/auth.json, which is set using podman
68       login.  If the authorization state is not found there,
69       $HOME/.docker/config.json is checked, which is set using docker login.
70       (Not available for remote commands)
71
72
73       Note: You can also override the default path of the authentication file
74       by setting the REGISTRY_AUTH_FILE environment variable. export
75       REGISTRY_AUTH_FILE=path
76
77
78       --build-arg arg=value
79
80
81       Specifies a build argument and its value, which will be interpolated in
82       instructions read from the Dockerfiles in the same way that environment
83       variables are, but which will not be added to environment variable list
84       in the resulting image's configuration.
85
86
87       --cache-from
88
89
90       Images to utilize as potential cache sources. Podman does not currently
91       support caching so this is a NOOP.
92
93
94       --cap-add=CAP_xxx
95
96
97       When executing RUN instructions, run the command specified in the
98       instruction with the specified capability added to its capability set.
99       Certain capabilities are granted by default; this option can be used to
100       add more.
101
102
103       --cap-drop=CAP_xxx
104
105
106       When executing RUN instructions, run the command specified in the
107       instruction with the specified capability removed from its capability
108       set.  The CAP_AUDIT_WRITE, CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_FOWNER,
109       CAP_FSETID, CAP_KILL, CAP_MKNOD, CAP_NET_BIND_SERVICE, CAP_SETFCAP,
110       CAP_SETGID, CAP_SETPCAP, CAP_SETUID, and CAP_SYS_CHROOT capabilities
111       are granted by default; this option can be used to remove them.
112
113
114       If a capability is specified to both the --cap-add and --cap-drop
115       options, it will be dropped, regardless of the order in which the
116       options were given.
117
118
119       --cert-dir path
120
121
122       Use certificates at path (*.crt, *.cert, *.key) to connect to the
123       registry.  Default certificates directory is /etc/containers/certs.d.
124       (Not available for remote commands)
125
126
127       --cgroup-parent=""
128
129
130       Path to cgroups under which the cgroup for the container will be
131       created. If the path is not absolute, the path is considered to be
132       relative to the cgroups path of the init process. Cgroups will be
133       created if they do not already exist.
134
135
136       --compress
137
138
139       This option is added to be aligned with other containers CLIs.  Podman
140       doesn't communicate with a daemon or a remote server.  Thus,
141       compressing the data before sending it is irrelevant to Podman.
142
143
144       --cni-config-dir=directory
145
146
147       Location of CNI configuration files which will dictate which plugins
148       will be used to configure network interfaces and routing for containers
149       created for handling RUN instructions, if those containers will be run
150       in their own network namespaces, and networking is not disabled.
151
152
153       --cni-plugin-path=directory[:directory[:directory[...]]]
154
155
156       List of directories in which the CNI plugins which will be used for
157       configuring network namespaces can be found.
158
159
160       --cpu-period=0
161
162
163       Limit the CPU CFS (Completely Fair Scheduler) period
164
165
166       Limit the container's CPU usage. This flag tell the kernel to restrict
167       the container's CPU usage to the period you specify.
168
169
170       --cpu-quota=0
171
172
173       Limit the CPU CFS (Completely Fair Scheduler) quota
174
175
176       Limit the container's CPU usage. By default, containers run with the
177       full CPU resource. This flag tell the kernel to restrict the
178       container's CPU usage to the quota you specify.
179
180
181       --cpu-shares, -c=0
182
183
184       CPU shares (relative weight)
185
186
187       By default, all containers get the same proportion of CPU cycles. This
188       proportion can be modified by changing the container's CPU share
189       weighting relative to the weighting of all other running containers.
190
191
192       To modify the proportion from the default of 1024, use the --cpu-shares
193       flag to set the weighting to 2 or higher.
194
195
196       The proportion will only apply when CPU-intensive processes are
197       running.  When tasks in one container are idle, other containers can
198       use the left-over CPU time. The actual amount of CPU time will vary
199       depending on the number of containers running on the system.
200
201
202       For example, consider three containers, one has a cpu-share of 1024 and
203       two others have a cpu-share setting of 512. When processes in all three
204       containers attempt to use 100% of CPU, the first container would
205       receive 50% of the total CPU time. If you add a fourth container with a
206       cpu-share of 1024, the first container only gets 33% of the CPU. The
207       remaining containers receive 16.5%, 16.5% and 33% of the CPU.
208
209
210       On a multi-core system, the shares of CPU time are distributed over all
211       CPU cores. Even if a container is limited to less than 100% of CPU
212       time, it can use 100% of each individual CPU core.
213
214
215       For example, consider a system with more than three cores. If you start
216       one container {C0} with -c=512 running one process, and another
217       container {C1} with -c=1024 running two processes, this can result in
218       the following division of CPU shares:
219
220
221              PID    container    CPU CPU share
222              100    {C0}     0   100% of CPU0
223              101    {C1}     1   100% of CPU1
224              102    {C1}     2   100% of CPU2
225
226
227
228       --cpuset-cpus=""
229
230
231       CPUs in which to allow execution (0-3, 0,1)
232
233
234       --cpuset-mems=""
235
236
237       Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only
238       effective on NUMA systems.
239
240
241       If you have four memory nodes on your system (0-3), use
242       --cpuset-mems=0,1 then processes in your container will only use memory
243       from the first two memory nodes.
244
245
246       --creds creds
247
248
249       The [username[:password]] to use to authenticate with the registry if
250       required.  If one or both values are not supplied, a command line
251       prompt will appear and the value can be entered.  The password is
252       entered without echo.
253
254
255       --disable-content-trust
256
257
258       This is a Docker specific option to disable image verification to a
259       Docker registry and is not supported by Podman.  This flag is a NOOP
260       and provided soley for scripting compatibility.
261
262
263       --dns=[]
264
265
266       Set custom DNS servers
267
268
269       --dns-option=[]
270
271
272       Set custom DNS options
273
274
275       --dns-search=[]
276
277
278       Set custom DNS search domains
279
280
281       --file, -f Dockerfile
282
283
284       Specifies a Dockerfile which contains instructions for building the
285       image, either a local file or an http or https URL.  If more than one
286       Dockerfile is specified, FROM instructions will only be accepted from
287       the first specified file.
288
289
290       If a build context is not specified, and at least one Dockerfile is a
291       local file, the directory in which it resides will be used as the build
292       context.
293
294
295       If you specify -f -, the Dockerfile contents will be read from stdin.
296
297
298       --force-rm bool-value
299
300
301       Always remove intermediate containers after a build, even if the build
302       is unsuccessful.
303
304
305       --format
306
307
308       Control the format for the built image's manifest and configuration
309       data.  Recognized formats include oci (OCI image-spec v1.0, the
310       default) and docker (version 2, using schema format 2 for the
311       manifest).
312
313
314       Note: You can also override the default format by setting the
315       BUILDAH_FORMAT environment variable.  export BUILDAH_FORMAT=docker
316
317
318       --iidfile ImageIDfile
319
320
321       Write the image ID to the file.
322
323
324       --ipc how
325
326
327       Sets the configuration for IPC namespaces when handling RUN
328       instructions.  The configured value can be "" (the empty string) or
329       "container" to indicate that a new IPC namespace should be created, or
330       it can be "host" to indicate that the IPC namespace in which podman
331       itself is being run should be reused, or it can be the path to an IPC
332       namespace which is already in use by another process.
333
334
335       --isolation type
336
337
338       Controls what type of isolation is used for running processes as part
339       of RUN instructions.  Recognized types include oci (OCI-compatible
340       runtime, the default), rootless (OCI-compatible runtime invoked using a
341       modified configuration and its --rootless flag enabled, with
342       --no-new-keyring --no-pivot added to its create invocation, with
343       network and UTS namespaces disabled, and IPC, PID, and user namespaces
344       enabled; the default for unprivileged users), and chroot (an internal
345       wrapper that leans more toward chroot(1) than container technology).
346
347
348       Note: You can also override the default isolation type by setting the
349       BUILDAH_ISOLATION environment variable.  export BUILDAH_ISOLATION=oci
350
351
352       --label label
353
354
355       Add an image label (e.g. label=value) to the image metadata. Can be
356       used multiple times.
357
358
359       --layers
360
361
362       Cache intermediate images during the build process (Default is true).
363
364
365       Note: You can also override the default value of layers by setting the
366       BUILDAH_LAYERS environment variable. export BUILDAH_LAYERS=true
367
368
369       --logfile filename
370
371
372       Log output which would be sent to standard output and standard error to
373       the specified file instead of to standard output and standard error.
374
375
376       --memory, -m="" Memory limit (format: <number>[<unit>], where unit = b,
377       k, m or g)
378
379
380       Allows you to constrain the memory available to a container. If the
381       host supports swap memory, then the -m memory setting can be larger
382       than physical RAM. If a limit of 0 is specified (not using -m), the
383       container's memory is not limited. The actual limit may be rounded up
384       to a multiple of the operating system's page size (the value would be
385       very large, that's millions of trillions).
386
387
388       --memory-swap="LIMIT"
389
390
391       A limit value equal to memory plus swap. Must be used with the  -m
392       (--memory) flag. The swap LIMIT should always be larger than -m
393       (--memory) value.  By default, the swap LIMIT will be set to double the
394       value of --memory.
395
396
397       The format of LIMIT is <number>[<unit>]. Unit can be b (bytes), k
398       (kilobytes), m (megabytes), or g (gigabytes). If you don't specify a
399       unit, b is used. Set LIMIT to -1 to enable unlimited swap.
400
401
402       --net how --network how
403
404
405       Sets the configuration for network namespaces when handling RUN
406       instructions.  The configured value can be "" (the empty string) or
407       "container" to indicate that a new network namespace should be created,
408       or it can be "host" to indicate that the network namespace in which
409       podman itself is being run should be reused, or it can be the path to a
410       network namespace which is already in use by another process.
411
412
413       --no-cache
414
415
416       Do not use existing cached images for the container build. Build from
417       the start with a new set of cached layers.
418
419
420       --pid how
421
422
423       Sets the configuration for PID namespaces when handling RUN
424       instructions.  The configured value can be "" (the empty string) or
425       "container" to indicate that a new PID namespace should be created, or
426       it can be "host" to indicate that the PID namespace in which podman
427       itself is being run should be reused, or it can be the path to a PID
428       namespace which is already in use by another process.
429
430
431       --pull
432
433
434       When the flag is enabled, attempt to pull the latest image from the
435       registries listed in registries.conf if a local image does not exist or
436       the image is newer than the one in storage. Raise an error if the image
437       is not in any listed registry and is not present locally.
438
439
440       If the flag is disabled (with --pull=false), do not pull the image from
441       the registry, use only the local version. Raise an error if the image
442       is not present locally.
443
444
445       Defaults to true.
446
447
448       --pull-always
449
450
451       Pull the image from the first registry it is found in as listed in
452       registries.conf.  Raise an error if not found in the registries, even
453       if the image is present locally.
454
455
456       --quiet, -q
457
458
459       Suppress output messages which indicate which instruction is being
460       processed, and of progress when pulling images from a registry, and
461       when writing the output image.
462
463
464       --rm bool-value
465
466
467       Remove intermediate containers after a successful build (default true).
468
469
470       --runtime path
471
472
473       The path to an alternate OCI-compatible runtime, which will be used to
474       run commands specified by the RUN instruction.
475
476
477       Note: You can also override the default runtime by setting the
478       BUILDAH_RUNTIME environment variable.  export
479       BUILDAH_RUNTIME=/usr/local/bin/runc
480
481
482       --runtime-flag flag
483
484
485       Adds global flags for the container rutime. To list the supported
486       flags, please consult the manpages of the selected container runtime
487       (runc is the default runtime, the manpage to consult is runc(8)).
488
489
490       Note: Do not pass the leading -- to the flag. To pass the runc flag
491       --log-format json to podman build, the option given would be
492       --runtime-flag log-format=json.
493
494
495       --security-opt=[]
496
497
498       Security Options
499
500
501       "label=user:USER"   : Set the label user for the container
502         "label=role:ROLE"   : Set the label role for the container
503         "label=type:TYPE"   : Set the label type for the container
504         "label=level:LEVEL" : Set the label level for the container
505         "label=disable"     : Turn off label confinement for the container
506         "no-new-privileges" : Not supported
507
508
509       "seccomp=unconfined" : Turn off seccomp confinement for the container
510         "seccomp=profile.json :  White listed syscalls seccomp Json file to
511       be used as a seccomp filter
512
513
514       "apparmor=unconfined" : Turn off apparmor confinement for the container
515         "apparmor=your-profile" : Set the apparmor confinement profile for
516       the container
517
518
519       --shm-size=""
520
521
522       Size of /dev/shm. The format is <number><unit>. number must be greater
523       than 0.  Unit is optional and can be b (bytes), k (kilobytes),
524       m(megabytes), or g (gigabytes).  If you omit the unit, the system uses
525       bytes. If you omit the size entirely, the system uses 64m.
526
527
528       --squash
529
530
531       Squash all of the new image's layers (including those inherited from a
532       base image) into a single new layer.
533
534
535       --tag, -t imageName
536
537
538       Specifies the name which will be assigned to the resulting image if the
539       build process completes successfully.  If imageName does not include a
540       registry name, the registry name localhost will be prepended to the
541       image name.
542
543
544       --target stageName
545
546
547       Set the target build stage to build.  When building a Dockerfile with
548       multiple build stages, --target can be used to specify an intermediate
549       build stage by name as the final stage for the resulting image.
550       Commands after the target stage will be skipped.
551
552
553       --tls-verify bool-value
554
555
556       Require HTTPS and verify certificates when talking to container
557       registries (defaults to true). (Not available for remote commands)
558
559
560       --ulimit=type=soft-limit[:hard-limit]
561
562
563       Specifies resource limits to apply to processes launched when
564       processing RUN instructions.  This option can be specified multiple
565       times.  Recognized resource types include:
566         "core": maximimum core dump size (ulimit -c)
567         "cpu": maximum CPU time (ulimit -t)
568         "data": maximum size of a process's data segment (ulimit -d)
569         "fsize": maximum size of new files (ulimit -f)
570         "locks": maximum number of file locks (ulimit -x)
571         "memlock": maximum amount of locked memory (ulimit -l)
572         "msgqueue": maximum amount of data in message queues (ulimit -q)
573         "nice": niceness adjustment (nice -n, ulimit -e)
574         "nofile": maximum number of open files (ulimit -n)
575         "nproc": maximum number of processes (ulimit -u)
576         "rss": maximum size of a process's (ulimit -m)
577         "rtprio": maximum real-time scheduling priority (ulimit -r)
578         "rttime": maximum amount of real-time execution between blocking
579       syscalls
580         "sigpending": maximum number of pending signals (ulimit -i)
581         "stack": maximum stack size (ulimit -s)
582
583
584       --userns how
585
586
587       Sets the configuration for user namespaces when handling RUN
588       instructions.  The configured value can be "" (the empty string) or
589       "container" to indicate that a new user namespace should be created, it
590       can be "host" to indicate that the user namespace in which podman
591       itself is being run should be reused, or it can be the path to an user
592       namespace which is already in use by another process.
593
594
595       --userns-uid-map mapping
596
597
598       Directly specifies a UID mapping which should be used to set ownership,
599       at the filesytem level, on the working container's contents.  Commands
600       run when handling RUN instructions will default to being run in their
601       own user namespaces, configured using the UID and GID maps.
602
603
604       Entries in this map take the form of one or more triples of a starting
605       in-container UID, a corresponding starting host-level UID, and the
606       number of consecutive IDs which the map entry represents.
607
608
609       This option overrides the remap-uids setting in the options section of
610       /etc/containers/storage.conf.
611
612
613       If this option is not specified, but a global --userns-uid-map setting
614       is supplied, settings from the global option will be used.
615
616
617       If none of --userns-uid-map-user, --userns-gid-map-group, or
618       --userns-uid-map are specified, but --userns-gid-map is specified, the
619       UID map will be set to use the same numeric values as the GID map.
620
621
622       --userns-gid-map mapping
623
624
625       Directly specifies a GID mapping which should be used to set ownership,
626       at the filesytem level, on the working container's contents.  Commands
627       run when handling RUN instructions will default to being run in their
628       own user namespaces, configured using the UID and GID maps.
629
630
631       Entries in this map take the form of one or more triples of a starting
632       in-container GID, a corresponding starting host-level GID, and the
633       number of consecutive IDs which the map entry represents.
634
635
636       This option overrides the remap-gids setting in the options section of
637       /etc/containers/storage.conf.
638
639
640       If this option is not specified, but a global --userns-gid-map setting
641       is supplied, settings from the global option will be used.
642
643
644       If none of --userns-uid-map-user, --userns-gid-map-group, or
645       --userns-gid-map are specified, but --userns-uid-map is specified, the
646       GID map will be set to use the same numeric values as the UID map.
647
648
649       --userns-uid-map-user user
650
651
652       Specifies that a UID mapping which should be used to set ownership, at
653       the filesytem level, on the working container's contents, can be found
654       in entries in the /etc/subuid file which correspond to the specified
655       user.  Commands run when handling RUN instructions will default to
656       being run in their own user namespaces, configured using the UID and
657       GID maps.  If --userns-gid-map-group is specified, but
658       --userns-uid-map-user is not specified, podman will assume that the
659       specified group name is also a suitable user name to use as the default
660       setting for this option.
661
662
663       --userns-gid-map-group group
664
665
666       Specifies that a GID mapping which should be used to set ownership, at
667       the filesytem level, on the working container's contents, can be found
668       in entries in the /etc/subgid file which correspond to the specified
669       group.  Commands run when handling RUN instructions will default to
670       being run in their own user namespaces, configured using the UID and
671       GID maps.  If --userns-uid-map-user is specified, but
672       --userns-gid-map-group is not specified, podman will assume that the
673       specified user name is also a suitable group name to use as the default
674       setting for this option.
675
676
677       --uts how
678
679
680       Sets the configuration for UTS namespaces when the handling RUN
681       instructions.  The configured value can be "" (the empty string) or
682       "container" to indicate that a new UTS namespace should be created, or
683       it can be "host" to indicate that the UTS namespace in which podman
684       itself is being run should be reused, or it can be the path to a UTS
685       namespace which is already in use by another process.
686
687
688       --volume, -v[=[HOST-DIR:CONTAINER-DIR[:OPTIONS]]]
689
690
691       Create a bind mount. If you specify, -v /HOST-DIR:/CONTAINER-DIR,
692       podman
693          bind mounts /HOST-DIR in the host to /CONTAINER-DIR in the podman
694          container. The OPTIONS are a comma delimited list and can be:
695
696
697              · [rw|ro]
698
699              · [z|Z]
700
701              · [[r]shared|[r]slave|[r]private]
702
703
704
705       The CONTAINER-DIR must be an absolute path such as /src/docs. The
706       HOST-DIR must be an absolute path as well. Podman bind-mounts the
707       HOST-DIR to the path you specify. For example, if you supply /foo as
708       the host path, Podman copies the contents of /foo to the container
709       filesystem on the host and bind mounts that into the container.
710
711
712       You can specify multiple  -v options to mount one or more mounts to a
713       container.
714
715
716       You can add the :ro or :rw suffix to a volume to mount it read-only or
717       read-write mode, respectively. By default, the volumes are mounted
718       read-write.  See examples.
719
720
721       Labeling Volume Mounts
722
723
724       Labeling systems like SELinux require that proper labels are placed on
725       volume content mounted into a container. Without a label, the security
726       system might prevent the processes running inside the container from
727       using the content. By default, podman does not change the labels set by
728       the OS.
729
730
731       To change a label in the container context, you can add either of two
732       suffixes :z or :Z to the volume mount. These suffixes tell podman to
733       relabel file objects on the shared volumes. The z option tells podman
734       that two containers share the volume content. As a result, podman
735       labels the content with a shared content label. Shared volume labels
736       allow all containers to read/write content.  The Z option tells podman
737       to label the content with a private unshared label.  Only the current
738       container can use a private volume.
739
740
741       Overlay Volume Mounts
742
743
744       The :O flag tells Buildah to mount the directory from the host as a
745       temporary storage using the Overlay file system. The RUN command
746       containers are allowed to modify contents within the mountpoint and are
747       stored in the container storage in a separate directory.  In Ovelay FS
748       terms the source directory will be the lower, and the container storage
749       directory will be the upper. Modifications to the mount point are
750       destroyed when the RUN command finishes executing, similar to a tmpfs
751       mount point.
752
753
754       Any subsequent execution of RUN commands sees the original source
755       directory content, any changes from previous RUN commands no longer
756       exists.
757
758
759       One use case of the overlay mount is sharing the package cache from the
760       host into the container to allow speeding up builds.
761
762
763       Note:
764
765
766               - Overlay mounts are not currently supported in rootless mode.
767               - The `O` flag is not allowed to be specified with the `Z` or `z` flags. Content mounted into the container is labeled with the private label.
768                 On SELinux systems, labels in the source directory needs to be readable by the container label. If not, SELinux container separation must be disabled for the container to work.
769               - Modification of the directory volume mounted into the container with an overlay mount can cause unexpected failures.  It is recommended that you do not modify the directory until the container finishes running.
770
771
772
773       By default bind mounted volumes are private. That means any mounts done
774       inside container will not be visible on the host and vice versa. This
775       behavior can be changed by specifying a volume mount propagation
776       property.
777
778
779       When the mount propagation policy is set to shared, any mounts
780       completed inside the container on that volume will be visible to both
781       the host and container. When the mount propagation policy is set to
782       slave, one way mount propagation is enabled and any mounts completed on
783       the host for that volume will be visible only inside of the container.
784       To control the mount propagation property of volume use the :[r]shared,
785       :[r]slave or :[r]private propagation flag. The propagation property can
786       be specified only for bind mounted volumes and not for internal volumes
787       or named volumes. For mount propagation to work on the source mount
788       point (mount point where source dir is mounted on) has to have the
789       right propagation properties. For shared volumes, the source mount
790       point has to be shared. And for slave volumes, the source mount has to
791       be either shared or slave.
792
793
794       Use df <source-dir> to determine the source mount and then use findmnt
795       -o TARGET,PROPAGATION <source-mount-dir> to determine propagation
796       properties of source mount, if findmnt utility is not available, the
797       source mount point can be determined by looking at the mount entry in
798       /proc/self/mountinfo. Look at optional fields and see if any propagaion
799       properties are specified.  shared:X means the mount is shared, master:X
800       means the mount is slave and if nothing is there that means the mount
801       is private.
802
803
804       To change propagation properties of a mount point use the mount
805       command. For example, to bind mount the source directory /foo do mount
806       --bind /foo /foo and mount --make-private --make-shared /foo. This will
807       convert /foo into a shared mount point.  The propagation properties of
808       the source mount can be changed directly. For instance if / is the
809       source mount for /foo, then use mount --make-shared / to convert / into
810       a shared mount.
811
812

EXAMPLES

814   Build an image using local Dockerfiles
815              $ podman build .
816
817              $ podman build -f Dockerfile.simple .
818
819              $ cat  /Dockerfile | podman build -f - .
820
821              $ podman build -f Dockerfile.simple -f Dockerfile.notsosimple .
822
823              $ podman build -f Dockerfile.in
824
825              $ podman build -t imageName .
826
827              $ podman build --tls-verify=true -t imageName -f Dockerfile.simple .
828
829              $ podman build --tls-verify=false -t imageName .
830
831              $ podman build --runtime-flag log-format=json .
832
833              $ podman build --runtime-flag debug .
834
835              $ podman build --authfile /tmp/auths/myauths.json --cert-dir  /auth --tls-verify=true --creds=username:password -t imageName -f Dockerfile.simple .
836
837              $ podman build --memory 40m --cpu-period 10000 --cpu-quota 50000 --ulimit nofile=1024:1028 -t imageName .
838
839              $ podman build --security-opt label=level:s0:c100,c200 --cgroup-parent /path/to/cgroup/parent -t imageName .
840
841              $ podman build --volume /home/test:/myvol:ro,Z -t imageName .
842
843              $ podman build -v /var/lib/yum:/var/lib/yum:O -t imageName .
844
845              $ podman build --layers -t imageName .
846
847              $ podman build --no-cache -t imageName .
848
849              $ podman build --layers --force-rm -t imageName .
850
851              $ podman build --no-cache --rm=false -t imageName .
852
853
854
855   Building an image using a URL, Git repo, or archive
856       The build context directory can be specified as a URL to a Dockerfile,
857       a Git repository, or URL to an archive. If the URL is a Dockerfile, it
858       is downloaded to a temporary location and used as the context. When a
859       Git repository is set as the URL, the repository is cloned locally to a
860       temporary location and then used as the context. Lastly, if the URL is
861       an archive, it is downloaded to a temporary location and extracted
862       before being used as the context.
863
864
865   Building an image using a URL to a Dockerfile
866       Podman will download the Dockerfile to a temporary location and then
867       use it as the build context.
868
869
870              $ podman build https://10.10.10.1/podman/Dockerfile
871
872
873
874   Building an image using a Git repository
875       Podman will clone the specified GitHub repository to a temporary
876       location and use it as the context. The Dockerfile at the root of the
877       repository will be used and it only works if the GitHub repository is a
878       dedicated repository.
879
880
881              $ podman build git://github.com/scollier/purpletest
882
883
884
885   Building an image using a URL to an archive
886       Podman will fetch the archive file, decompress it, and use its contents
887       as the build context. The Dockerfile at the root of the archive and the
888       rest of the archive will get used as the context of the build. If you
889       pass -f PATH/Dockerfile option as well, the system will look for that
890       file inside the contents of the archive.
891
892
893              $ podman build -f dev/Dockerfile https://10.10.10.1/podman/context.tar.gz
894
895
896
897       Note: supported compression formats are 'xz', 'bzip2', 'gzip' and
898       'identity' (no compression).
899
900

Files

902       registries.conf (/etc/containers/registries.conf)
903
904
905       registries.conf is the configuration file which specifies which
906       container registries should be consulted when completing image names
907       which do not include a registry or domain portion.
908
909

Troubleshooting

911       If you are using a useradd command within a Dockerfile with a large
912       UID/GID, it will create a large sparse file /var/log/lastlog.  This can
913       cause the build to hang forever.  Go language does not support sparse
914       files correctly, which can lead to some huge files being created in
915       your container image.
916
917
918   Solution
919       If you are using useradd within your build script, you should pass the
920       --no-log-init or -l option to the useradd command.  This option tells
921       useradd to stop creating the lastlog file.
922
923

SEE ALSO

925       podman(1), buildah(1), containers-registries.conf(5), useradd(8)
926
927

HISTORY

929       May 2018, Minor revisions added by Joe Doss ⟨joe@solidadmin.com⟩
930
931
932       December 2017, Originally compiled by Tom Sweeney ⟨tsweeney@redhat.com⟩
933
934
935
936                                                               podman-build(1)
Impressum