1buildah-from(1)             General Commands Manual            buildah-from(1)
2
3
4

NAME

6       buildah-from  - Creates a new working container, either from scratch or
7       using a specified image as a starting point.
8
9

SYNOPSIS

11       buildah from [options] image
12
13

DESCRIPTION

15       Creates a working container based upon the specified  image  name.   If
16       the  supplied image name is "scratch" a new empty container is created.
17       Image names use a "transport":"details" format.
18
19
20       Multiple transports are supported:
21
22
23       dir:path
24         An existing local directory path containing the manifest, layer  tar‐
25       balls,  and  signatures in individual files. This is a non-standardized
26       format, primarily useful for debugging or noninvasive image inspection.
27
28
29       docker://docker-reference (Default)
30         An image in a registry implementing the  "Docker  Registry  HTTP  API
31       V2".   By   default,   uses   the  authorization  state  in  $XDG\_RUN‐
32       TIME\_DIR/containers/auth.json, which is set using (buildah login).  If
33       XDG_RUNTIME_DIR    is   not   set,   the   default   is   /run/contain‐
34       ers/$UID/auth.json. If the authorization  state  is  not  found  there,
35       $HOME/.docker/config.json  is  checked,  which is set using (docker lo‐
36       gin).
37         If docker-reference does not include a registry name, localhost  will
38       be  consulted first, followed by any registries named in the registries
39       configuration.
40
41
42       docker-archive:path
43         An image is retrieved as a podman load formatted file.
44
45
46       docker-daemon:docker-reference
47         An image docker-reference stored  in  the  docker  daemon's  internal
48       storage.   docker-reference must include either a tag or a digest.  Al‐
49       ternatively, when reading images, the format can  also  be  docker-dae‐
50       mon:algo:digest (an image ID).
51
52
53       oci:path:tag**
54         An image tag in a directory compliant with "Open Container Image Lay‐
55       out Specification" at path.
56
57
58       oci-archive:path:tag
59         An image tag in a directory compliant with "Open Container Image Lay‐
60       out Specification" at path.
61
62
63   DEPENDENCIES
64       Buildah  resolves  the  path  to the registry to pull from by using the
65       /etc/containers/registries.conf  file,   containers-registries.conf(5).
66       If  the  buildah  from  command  fails with an "image not known" error,
67       first verify that the registries.conf file is installed and  configured
68       appropriately.
69
70

RETURN VALUE

72       The  container ID of the container that was created.  On error 1 is re‐
73       turned.
74
75

OPTIONS

77       --add-host=[]
78
79
80       Add a custom host-to-IP mapping (host:ip)
81
82
83       Add a line to /etc/hosts. The format is hostname:ip. The --add-host op‐
84       tion can be set multiple times.
85
86
87       --arch="ARCH"
88
89
90       Set the ARCH of the image to be pulled to the provided value instead of
91       using the architecture of the host. (Examples: arm, arm64, 386,  amd64,
92       ppc64le, s390x)
93
94
95       --authfile path
96
97
98       Path  of  the  authentication file. Default is ${XDG_\RUNTIME_DIR}/con‐
99       tainers/auth.json. If  XDG_RUNTIME_DIR  is  not  set,  the  default  is
100       /run/containers/$UID/auth.json.  This file is created using buildah lo‐
101       gin.
102
103
104       If the authorization  state  is  not  found  there,  $HOME/.docker/con‐
105       fig.json is checked, which is set using docker login.
106
107
108       Note: You can also override the default path of the authentication file
109       by setting the REGISTRY_AUTH_FILE  environment  variable.  export  REG‐
110       ISTRY_AUTH_FILE=path
111
112
113       --cap-add=CAP_xxx
114
115
116       Add  the  specified capability to the default set of capabilities which
117       will be supplied for subsequent buildah run invocations which use  this
118       container.   Certain  capabilities  are granted by default; this option
119       can be used to add more.
120
121
122       --cap-drop=CAP_xxx
123
124
125       Remove the specified capability from the default  set  of  capabilities
126       which will be supplied for subsequent buildah run invocations which use
127       this  container.   The  CAP_AUDIT_WRITE,  CAP_CHOWN,  CAP_DAC_OVERRIDE,
128       CAP_FOWNER,   CAP_FSETID,  CAP_KILL,  CAP_MKNOD,  CAP_NET_BIND_SERVICE,
129       CAP_SETFCAP, CAP_SETGID, CAP_SETPCAP,  CAP_SETUID,  and  CAP_SYS_CHROOT
130       capabilities  are granted by default; this option can be used to remove
131       them.
132
133
134       If a capability is specified to both the --cap-add and  --cap-drop  op‐
135       tions, it will be dropped, regardless of the order in which the options
136       were given.
137
138
139       --cert-dir path
140
141
142       Use certificates at path (*.crt, *.cert, *.key) to connect to the  reg‐
143       istry.  The default certificates directory is /etc/containers/certs.d.
144
145
146       --cgroup-parent=""
147
148
149       Path  to  cgroups under which the cgroup for the container will be cre‐
150       ated. If the path is not absolute, the path is considered to  be  rela‐
151       tive  to  the cgroups path of the init process. Cgroups will be created
152       if they do not already exist.
153
154
155       --cgroupns how
156
157
158       Sets the configuration for IPC namespaces when the container is  subse‐
159       quently  used  for  buildah  run.   The configured value can be "" (the
160       empty string) or "private" to indicate  that  a  new  cgroup  namespace
161       should  be  created,  or  it  can be "host" to indicate that the cgroup
162       namespace in which buildah itself is being run should be reused.
163
164
165       --cidfile ContainerIDFile
166
167
168       Write the container ID to the file.
169
170
171       --cpu-period=0
172
173
174       Limit the CPU CFS (Completely Fair Scheduler) period
175
176
177       Limit the container's CPU usage. This flag tells the kernel to restrict
178       the container's CPU usage to the period you specify.
179
180
181       --cpu-quota=0
182
183
184       Limit the CPU CFS (Completely Fair Scheduler) quota
185
186
187       Limit  the  container's  CPU usage. By default, containers run with the
188       full CPU resource. This flag tells the  kernel  to  restrict  the  con‐
189       tainer's CPU usage to the quota you specify.
190
191
192       --cpu-shares, -c=0
193
194
195       CPU shares (relative weight)
196
197
198       By  default, all containers get the same proportion of CPU cycles. This
199       proportion can be  modified  by  changing  the  container's  CPU  share
200       weighting relative to the weighting of all other running containers.
201
202
203       To modify the proportion from the default of 1024, use the --cpu-shares
204       flag to set the weighting to 2 or higher.
205
206
207       The proportion will only apply when CPU-intensive  processes  are  run‐
208       ning.   When  tasks in one container are idle, other containers can use
209       the left-over CPU time. The actual amount of CPU time will vary depend‐
210       ing on the number of containers running on the system.
211
212
213       For example, consider three containers, one has a cpu-share of 1024 and
214       two others have a cpu-share setting of 512. When processes in all three
215       containers  attempt  to  use 100% of CPU, the first container would re‐
216       ceive 50% of the total CPU time. If you add a fourth container  with  a
217       cpu-share  of  1024,  the first container only gets 33% of the CPU. The
218       remaining containers receive 16.5%, 16.5% and 33% of the CPU.
219
220
221       On a multi-core system, the shares of CPU time are distributed over all
222       CPU  cores.  Even  if  a  container is limited to less than 100% of CPU
223       time, it can use 100% of each individual CPU core.
224
225
226       For example, consider a system with more than three cores. If you start
227       one  container  {C0}  with -c=512 running one process, and another con‐
228       tainer {C1} with -c=1024 running two processes, this can result in  the
229       following division of CPU shares:
230
231
232              PID    container    CPU  CPU share
233              100    {C0}         0    100% of CPU0
234              101    {C1}         1    100% of CPU1
235              102    {C1}         2    100% of CPU2
236
237
238
239       --cpuset-cpus=""
240
241
242       CPUs in which to allow execution (0-3, 0,1)
243
244
245       --cpuset-mems=""
246
247
248       Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effec‐
249       tive on NUMA systems.
250
251
252       If you have four memory nodes  on  your  system  (0-3),  use  --cpuset-
253       mems=0,1 then processes in your container will only use memory from the
254       first two memory nodes.
255
256
257       --creds creds
258
259
260       The [username[:password]] to use to authenticate with the  registry  if
261       required.   If  one  or  both  values  are not supplied, a command line
262       prompt will appear and the value can be entered.  The password  is  en‐
263       tered without echo.
264
265
266       --decryption-key key[:passphrase]
267
268
269       The  [key[:passphrase]]  to  be  used for decryption of images. Key can
270       point to keys and/or certificates. Decryption will be  tried  with  all
271       keys.  If  the  key  is protected by a passphrase, it is required to be
272       passed in the argument and omitted otherwise.
273
274
275       --device=device
276
277
278       Add a host device or devices under a directory to  the  container.  The
279       format    is   <device-on-host>[:<device-on-container>][:<permissions>]
280       (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
281
282
283       --dns=[]
284
285
286       Set custom DNS servers
287
288
289       This option can be used to override the DNS configuration passed to the
290       container.  Typically this is necessary when the host DNS configuration
291       is invalid for the container (e.g., 127.0.0.1). When this is  the  case
292       the --dns flag is necessary for every run.
293
294
295       The special value none can be specified to disable creation of /etc/re‐
296       solv.conf in the container by Buildah. The /etc/resolv.conf file in the
297       image will be used without changes.
298
299
300       --dns-option=[]
301
302
303       Set custom DNS options
304
305
306       --dns-search=[]
307
308
309       Set custom DNS search domains
310
311
312       --format, -f oci | docker
313
314
315       Control  the  format  for  the built image's manifest and configuration
316       data.  Recognized formats include oci (OCI  image-spec  v1.0,  the  de‐
317       fault) and docker (version 2, using schema format 2 for the manifest).
318
319
320       Note:  You  can  also  override the default format by setting the BUIL‐
321       DAH_FORMAT environment variable.  export BUILDAH_FORMAT=docker
322
323
324       --http-proxy
325
326
327       By default proxy environment variables are passed into the container if
328       set  for  the  Buildah  process.   This  can be disabled by setting the
329       --http-proxy option to false.  The environment variables passed in  in‐
330       clude  http_proxy, https_proxy, ftp_proxy, no_proxy, and also the upper
331       case versions of those.
332
333
334       Defaults to true
335
336
337       --ipc how
338
339
340       Sets the configuration for IPC namespaces when the container is  subse‐
341       quently  used  for  buildah  run.   The configured value can be "" (the
342       empty string) or "container" to  indicate  that  a  new  IPC  namespace
343       should  be  created, or it can be "host" to indicate that the IPC name‐
344       space in which Buildah itself is being run should be reused, or it  can
345       be  the  path  to  an  IPC namespace which is already in use by another
346       process.
347
348
349       --isolation type
350
351
352       Controls what type of isolation is used  for  running  processes  under
353       buildah run.  Recognized types include oci (OCI-compatible runtime, the
354       default), rootless (OCI-compatible runtime  invoked  using  a  modified
355       configuration,  with  --no-new-keyring  added to its create invocation,
356       reusing the host's network and UTS  namespaces,  and  creating  private
357       IPC,  PID,  mount,  and  user  namespaces; the default for unprivileged
358       users), and chroot (an internal wrapper  that  leans  more  toward  ch‐
359       root(1)  than  container  technology, reusing the host's control group,
360       network, IPC, and PID namespaces, and creating private  mount  and  UTS
361       namespaces, and creating user namespaces only when they're required for
362       ID mapping).
363
364
365       Note: You can also override the default isolation type by  setting  the
366       BUILDAH_ISOLATION environment variable.  export BUILDAH_ISOLATION=oci
367
368
369       --memory, -m=""
370
371
372       Memory limit (format: [], where unit = b, k, m or g)
373
374
375       Allows  you  to  constrain  the memory available to a container. If the
376       host supports swap memory, then the -m memory  setting  can  be  larger
377       than  physical  RAM.  If  a limit of 0 is specified (not using -m), the
378       container's memory is not limited. The actual limit may be  rounded  up
379       to  a  multiple of the operating system's page size (the value would be
380       very large, that's millions of trillions).
381
382
383       --memory-swap="LIMIT"
384
385
386       A limit value equal to memory plus swap. Must  be  used  with  the   -m
387       (--memory) flag. The swap LIMIT should always be larger than -m (--mem‐
388       ory) value.  By default, the swap LIMIT will be set to double the value
389       of --memory.
390
391
392       The  format  of  LIMIT  is  <number>[<unit>].  Unit can be b (bytes), k
393       (kilobytes), m (megabytes), or g (gigabytes). If you  don't  specify  a
394       unit, b is used. Set LIMIT to -1 to enable unlimited swap.
395
396
397       --name name
398
399
400       A name for the working container
401
402
403       --network how, --net how
404
405
406       Sets  the  configuration  for  network namespaces when the container is
407       subsequently used for buildah run.  The configured value can be "" (the
408       empty  string)  or "container" to indicate that a new network namespace
409       should be created, or it can be "host" to  indicate  that  the  network
410       namespace  in which Buildah itself is being run should be reused, or it
411       can be the path to a network namespace which is already in use  by  an‐
412       other process.
413
414
415       --os="OS"
416
417
418       Set  the  OS of the image to be pulled to the provided value instead of
419       using the current operating system of the host.
420
421
422       --pid how
423
424
425       Sets the configuration for PID namespaces when the container is  subse‐
426       quently  used  for  buildah  run.   The configured value can be "" (the
427       empty string) or "container" to  indicate  that  a  new  PID  namespace
428       should  be  created, or it can be "host" to indicate that the PID name‐
429       space in which Buildah itself is being run should be reused, or it  can
430       be  the  path  to  a  PID  namespace which is already in use by another
431       process.
432
433
434       --platform="OS/ARCH[/VARIANT]"
435
436
437       Set the OS/ARCH of the image to be pulled to the provided value instead
438       of using the current operating system and architecture of the host (for
439       example linux/arm).
440
441
442       OS/ARCH pairs are those used by the Go Programming Language.   In  sev‐
443       eral  cases  the ARCH value for a platform differs from one produced by
444       other tools such as the arch command.  Valid OS and  architecture  name
445       combinations   are   listed   as   values  for  $GOOS  and  $GOARCH  at
446       https://golang.org/doc/install/source#environment,  and  can  also   be
447       found by running go tool dist list.
448
449
450       While  buildah from is happy to pull an image for any platform that ex‐
451       ists, buildah run will not be able to run binaries provided by that im‐
452       age  without the help of emulation provided by packages like qemu-user-
453       static.
454
455
456       NOTE: The --platform option may not be used  in  combination  with  the
457       --arch, --os, or --variant options.
458
459
460       --pull
461
462
463       When  the flag is enabled or set explicitly to true (with --pull=true),
464       attempt to pull the latest image from the  registries  listed  in  reg‐
465       istries.conf if a local image does not exist or the image is newer than
466       the one in storage. Raise an error if the image is not  in  any  listed
467       registry and is not present locally.
468
469
470       If the flag is disabled (with --pull=false), do not pull the image from
471       the registry, use only the local version. Raise an error if  the  image
472       is not present locally.
473
474
475       If  the pull flag is set to always (with --pull=always), pull the image
476       from the first registry it is found in as  listed  in  registries.conf.
477       Raise  an  error  if  not found in the registries, even if the image is
478       present locally.
479
480
481       If the pull flag is set to never (with --pull=never), Do not  pull  the
482       image  from the registry, use only the local version. Raise an error if
483       the image is not present locally.
484
485
486       Defaults to true.
487
488
489       --quiet, -q
490
491
492       If an image needs to be pulled from  the  registry,  suppress  progress
493       output.
494
495
496       --security-opt=[]
497
498
499       Security Options
500
501
502       "label=user:USER"   : Set the label user for the container
503         "label=role:ROLE"   : Set the label role for the container
504         "label=type:TYPE"   : Set the label type for the container
505         "label=level:LEVEL" : Set the label level for the container
506         "label=disable"     : Turn off label confinement for the container
507         "no-new-privileges" : Not supported
508
509
510       "seccomp=unconfined" : Turn off seccomp confinement for the container
511         "seccomp=profile.json  :   White listed syscalls seccomp Json file to
512       be used as a seccomp filter
513
514
515       "apparmor=unconfined" : Turn off apparmor confinement for the container
516         "apparmor=your-profile" : Set the apparmor  confinement  profile  for
517       the container
518
519
520       --shm-size=""
521
522
523       Size  of /dev/shm. The format is <number><unit>. number must be greater
524       than 0.  Unit  is  optional  and  can  be  b  (bytes),  k  (kilobytes),
525       m(megabytes),  or g (gigabytes).  If you omit the unit, the system uses
526       bytes. If you omit the size entirely, the system uses 64m.
527
528
529       --tls-verify bool-value
530
531
532       Require HTTPS and verification of certificates  when  talking  to  con‐
533       tainer  registries (defaults to true).  TLS verification cannot be used
534       when talking to an insecure registry.
535
536
537       --ulimit type=soft-limit[:hard-limit]
538
539
540       Specifies resource limits to apply to processes launched during buildah
541       run.  This option can be specified multiple times.  Recognized resource
542       types include:
543         "core": maximum core dump size (ulimit -c)
544         "cpu": maximum CPU time (ulimit -t)
545         "data": maximum size of a process's data segment (ulimit -d)
546         "fsize": maximum size of new files (ulimit -f)
547         "locks": maximum number of file locks (ulimit -x)
548         "memlock": maximum amount of locked memory (ulimit -l)
549         "msgqueue": maximum amount of data in message queues (ulimit -q)
550         "nice": niceness adjustment (nice -n, ulimit -e)
551         "nofile": maximum number of open files (ulimit -n)
552         "nofile": maximum number of open files (1048576); when run by root
553         "nproc": maximum number of processes (ulimit -u)
554         "nproc": maximum number of processes (1048576); when run by root
555         "rss": maximum size of a process's (ulimit -m)
556         "rtprio": maximum real-time scheduling priority (ulimit -r)
557         "rttime": maximum amount  of  real-time  execution  between  blocking
558       syscalls
559         "sigpending": maximum number of pending signals (ulimit -i)
560         "stack": maximum stack size (ulimit -s)
561
562
563       --userns how
564
565
566       Sets the configuration for user namespaces when the container is subse‐
567       quently used for buildah run.  The configured  value  can  be  ""  (the
568       empty  string)  or  "container"  to  indicate that a new user namespace
569       should be created, it can be "host" to indicate that the user namespace
570       in which Buildah itself is being run should be reused, or it can be the
571       path to an user namespace which is already in use by another process.
572
573
574       --userns-gid-map-group mapping
575
576
577       Directly specifies a GID mapping which should be used to set ownership,
578       at the filesystem level, on the container's contents.  Commands run us‐
579       ing buildah run will default to being run in their own user namespaces,
580       configured using the UID and GID maps.
581
582
583       Entries  in this map take the form of one or more triples of a starting
584       in-container GID, a corresponding starting host-level GID, and the num‐
585       ber of consecutive IDs which the map entry represents.
586
587
588       This  option overrides the remap-gids setting in the options section of
589       /etc/containers/storage.conf.
590
591
592       If this option is not specified, but a global --userns-gid-map  setting
593       is supplied, settings from the global option will be used.
594
595
596       If  none of --userns-uid-map-user, --userns-gid-map-group, or --userns-
597       gid-map are specified, but --userns-uid-map is specified, the  GID  map
598       will be set to use the same numeric values as the UID map.
599
600
601       NOTE:  When  this option is specified by a rootless user, the specified
602       mappings are relative to the rootless usernamespace in  the  container,
603       rather than being relative to the host as it would be when run rootful.
604
605
606       --userns-gid-map-group group
607
608
609       Specifies  that a GID mapping which should be used to set ownership, at
610       the filesystem level, on the container's contents, can be found in  en‐
611       tries  in the /etc/subgid file which correspond to the specified group.
612       Commands run using buildah run will default to being run in  their  own
613       user  namespaces,  configured using the UID and GID maps.  If --userns-
614       uid-map-user is specified, but --userns-gid-map-group is not specified,
615       Buildah  will  assume  that  the specified user name is also a suitable
616       group name to use as the default setting for this option.
617
618
619       --userns-uid-map-user mapping
620
621
622       Directly specifies a UID mapping which should be used to set ownership,
623       at the filesystem level, on the container's contents.  Commands run us‐
624       ing buildah run will default to being run in their own user namespaces,
625       configured using the UID and GID maps.
626
627
628       Entries  in this map take the form of one or more triples of a starting
629       in-container UID, a corresponding starting host-level UID, and the num‐
630       ber of consecutive IDs which the map entry represents.
631
632
633       This  option overrides the remap-uids setting in the options section of
634       /etc/containers/storage.conf.
635
636
637       If this option is not specified, but a global --userns-uid-map  setting
638       is supplied, settings from the global option will be used.
639
640
641       If  none of --userns-uid-map-user, --userns-gid-map-group, or --userns-
642       uid-map are specified, but --userns-gid-map is specified, the  UID  map
643       will be set to use the same numeric values as the GID map.
644
645
646       NOTE:  When  this option is specified by a rootless user, the specified
647       mappings are relative to the rootless usernamespace in  the  container,
648       rather than being relative to the host as it would be when run rootful.
649
650
651       --userns-uid-map-user user
652
653
654       Specifies  that a UID mapping which should be used to set ownership, at
655       the filesystem level, on the container's contents, can be found in  en‐
656       tries  in  the /etc/subuid file which correspond to the specified user.
657       Commands run using buildah run will default to being run in  their  own
658       user  namespaces,  configured using the UID and GID maps.  If --userns-
659       gid-map-group is specified, but --userns-uid-map-user is not specified,
660       Buildah  will  assume  that the specified group name is also a suitable
661       user name to use as the default setting for this option.
662
663
664       --uts how
665
666
667       Sets the configuration for UTS namespaces when the container is  subse‐
668       quently  used  for  buildah  run.   The configured value can be "" (the
669       empty string) or "container" to  indicate  that  a  new  UTS  namespace
670       should  be  created, or it can be "host" to indicate that the UTS name‐
671       space in which Buildah itself is being run should be reused, or it  can
672       be  the  path  to  a  UTS  namespace which is already in use by another
673       process.
674
675
676       --variant=""
677
678
679       Set the architecture variant of the image to be pulled.
680
681
682       --volume, -v[=[HOST-DIR:CONTAINER-DIR[:OPTIONS]]]
683
684
685       Create a bind mount. If you specify, -v /HOST-DIR:/CONTAINER-DIR, Buil‐
686       dah
687          bind mounts /HOST-DIR in the host to /CONTAINER-DIR in the Buildah
688          container.  The  OPTIONS  are a comma delimited list and can be: [1]
689       ⟨#Footnote1⟩
690
691
692              • [rw|ro]
693
694              • [U]
695
696              • [z|Z|O]
697
698              • [[r]shared|[r]slave|[r]private|[r]unbindable]
699
700
701
702       The CONTAINER-DIR must be an absolute path such as /src/docs. The HOST-
703       DIR  must be an absolute path as well. Buildah bind-mounts the HOST-DIR
704       to the path you specify. For example, if you supply /foo  as  the  host
705       path,  Buildah  copies the contents of /foo to the container filesystem
706       on the host and bind mounts that into the container.
707
708
709       You can specify multiple  -v options to mount one or more mounts  to  a
710       container.
711
712
713       Write Protected Volume Mounts
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       Chowning Volume Mounts
722
723
724       By  default, Buildah does not change the owner and group of source vol‐
725       ume directories mounted into containers. If a container is created in a
726       new  user namespace, the UID and GID in the container may correspond to
727       another UID and GID on the host.
728
729
730       The :U suffix tells Buildah to use the correct host UID and  GID  based
731       on  the UID and GID within the container, to change the owner and group
732       of the source volume.
733
734
735       Labeling Volume Mounts
736
737
738       Labeling systems like SELinux require that proper labels are placed  on
739       volume  content mounted into a container. Without a label, the security
740       system might prevent the processes running inside  the  container  from
741       using  the  content. By default, Buildah does not change the labels set
742       by the OS.
743
744
745       To change a label in the container context, you can add either  of  two
746       suffixes  :z  or :Z to the volume mount. These suffixes tell Buildah to
747       relabel file objects on the shared volumes. The z option tells  Buildah
748       that  two containers share the volume content. As a result, Buildah la‐
749       bels the content with a shared content label. Shared volume labels  al‐
750       low  all  containers to read/write content.  The Z option tells Buildah
751       to label the content with a private unshared label.  Only  the  current
752       container can use a private volume.
753
754
755       Overlay Volume Mounts
756
757
758       The  :O  flag  tells  Buildah to mount the directory from the host as a
759       temporary storage using the Overlay file system. The RUN  command  con‐
760       tainers  are  allowed  to modify contents within the mountpoint and are
761       stored in the container storage in a separate directory.  In Overlay FS
762       terms the source directory will be the lower, and the container storage
763       directory will be the upper. Modifications to the mount point  are  de‐
764       stroyed  when  the  RUN  command finishes executing, similar to a tmpfs
765       mount point.
766
767
768       Any subsequent execution of RUN commands sees the original  source  di‐
769       rectory  content,  any changes from previous RUN commands no longer ex‐
770       ist.
771
772
773       One use case of the overlay mount is sharing the package cache from the
774       host into the container to allow speeding up builds.
775
776
777       Note:
778
779
780               - 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.
781                 On SELinux systems, labels in the source directory need to be readable by the container label. If not, SELinux container separation must be disabled for the container to work.
782               - 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.
783
784
785
786       By default bind mounted volumes are private. That means any mounts done
787       inside container will not be visible on the host and vice  versa.  This
788       behavior  can be changed by specifying a volume mount propagation prop‐
789       erty.
790
791
792       When the mount propagation policy is set to  shared,  any  mounts  com‐
793       pleted  inside the container on that volume will be visible to both the
794       host and container. When the mount propagation policy is set to  slave,
795       one  way  mount  propagation is enabled and any mounts completed on the
796       host for that volume will be visible only inside of the container.   To
797       control   the   mount  propagation  property  of  the  volume  use  the
798       :[r]shared, :[r]slave, [r]private or [r]unbindablepropagation flag. The
799       propagation property can be specified only for bind mounted volumes and
800       not for internal volumes or named volumes.  For  mount  propagation  to
801       work  on  the  source  mount point (the mount point where source dir is
802       mounted on) it has to have the right propagation properties. For shared
803       volumes,  the  source  mount point has to be shared. And for slave vol‐
804       umes, the source mount has to be either shared or  slave.  [1]  ⟨#Foot‐
805       note1⟩
806
807
808       Use  df <source-dir> to determine the source mount and then use findmnt
809       -o TARGET,PROPAGATION <source-mount-dir> to determine propagation prop‐
810       erties of source mount, if findmnt utility is not available, the source
811       mount point can  be  determined  by  looking  at  the  mount  entry  in
812       /proc/self/mountinfo.  Look  at optional fields and see if any propaga‐
813       tion properties are specified.  shared:X means  the  mount  is  shared,
814       master:X  means  the  mount is slave and if nothing is there that means
815       the mount is private. [1] ⟨#Footnote1⟩
816
817
818       To change propagation properties of a mount point use  the  mount  com‐
819       mand.  For  example,  to  bind mount the source directory /foo do mount
820       --bind /foo /foo and mount --make-private --make-shared /foo. This will
821       convert  /foo into a shared mount point.  The propagation properties of
822       the source mount can be changed directly. For  instance  if  /  is  the
823       source mount for /foo, then use mount --make-shared / to convert / into
824       a shared mount.
825
826

EXAMPLE

828       buildah from --pull imagename
829
830
831       buildah from --pull docker://myregistry.example.com/imagename
832
833
834       buildah from docker-daemon:imagename:imagetag
835
836
837       buildah from --name mycontainer docker-archive:filename
838
839
840       buildah from oci-archive:filename
841
842
843       buildah from --name mycontainer dir:directoryname
844
845
846       buildah  from  --pull-always  --name   "mycontainer"   myregistry.exam‐
847       ple.com/imagename
848
849
850       buildah  from  --tls-verify=false myregistry/myrepository/imagename:im‐
851       agetag
852
853
854       buildah from  --creds=myusername:mypassword  --cert-dir  ~/auth  myreg‐
855       istry/myrepository/imagename:imagetag
856
857
858       buildah  from  --authfile=/tmp/auths/myauths.json  myregistry/myreposi‐
859       tory/imagename:imagetag
860
861
862       buildah from --memory 40m --cpu-shares 2 --cpuset-cpus 0,2  --security-
863       opt label=level:s0:c100,c200 myregistry/myrepository/imagename:imagetag
864
865
866       buildah      from     --ulimit     nofile=1024:1028     --cgroup-parent
867       /path/to/cgroup/parent myregistry/myrepository/imagename:imagetag
868
869
870       buildah  from  --volume   /home/test:/myvol:ro,Z   myregistry/myreposi‐
871       tory/imagename:imagetag
872
873
874       buildah  from  -v  /home/test:/myvol:z,U myregistry/myrepository/image‐
875       name:imagetag
876
877
878       buildah from -v /var/lib/yum:/var/lib/yum:O myregistry/myrepository/im‐
879       agename:imagetag
880
881
882       buildah  from  --arch=arm  --variant  v7 myregistry/myrepository/image‐
883       name:imagetag
884
885

ENVIRONMENT

887       BUILD_REGISTRY_SOURCES
888
889
890       BUILD_REGISTRY_SOURCES, if set, is treated as a JSON object which  con‐
891       tains  lists  of  registry  names  under  the  keys insecureRegistries,
892       blockedRegistries, and allowedRegistries.
893
894
895       When pulling an image from a registry, if  the  name  of  the  registry
896       matches  any of the items in the blockedRegistries list, the image pull
897       attempt is denied.  If there are registries  in  the  allowedRegistries
898       list,  and  the registry's name is not in the list, the pull attempt is
899       denied.
900
901
902       TMPDIR The TMPDIR environment variable allows the user to specify where
903       temporary  files are stored while pulling and pushing images.  Defaults
904       to '/var/tmp'.
905
906

FILES

908       registries.conf (/etc/containers/registries.conf)
909
910
911       registries.conf is the configuration file which  specifies  which  con‐
912       tainer registries should be consulted when completing image names which
913       do not include a registry or domain portion.
914
915
916       policy.json (/etc/containers/policy.json)
917
918
919       Signature policy file.  This defines the trust policy for container im‐
920       ages.   Controls  which container registries can be used for image, and
921       whether or not the tool should trust the images.
922
923

SEE ALSO

925       buildah(1), buildah-pull(1), buildah-login(1),  docker-login(1),  name‐
926       spaces(7),  pid_namespaces(7),  containers-policy.json(5),  containers-
927       registries.conf(5), user_namespaces(7)
928
929

FOOTNOTES

931       1: The Buildah project is committed to inclusivity,  a  core  value  of
932       open  source.  The  master and slave mount propagation terminology used
933       here is problematic and divisive, and should be changed. However, these
934       terms are currently used within the Linux kernel and must be used as-is
935       at this time. When the kernel maintainers rectify this  usage,  Buildah
936       will follow suit immediately.
937
938
939
940buildah                           March 2017                   buildah-from(1)
Impressum