Commit Graph

420 Commits

Author SHA1 Message Date
Aditya R e81dd7983c
build, commit: allow removing default identity labels
Allow end users to remove default identity labels if they want to.
Since there are instances where images can be reproduced across version
hence users must have option to suppress default labels.

Closes: https://github.com/containers/buildah/issues/3826

Signed-off-by: Aditya R <arajan@redhat.com>
2022-04-04 11:07:01 +05:30
Ed Santiago ae8995568b [CI:DOCS] man pages: sort flags, and keep them that way
Enforce alphabetical ordering of command-line options in
man pages. Not as simple as with podman, because conventions
are different.

Reference: https://github.com/containers/podman/pull/13625

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-03-24 08:27:06 -06:00
Daniel J Walsh deb9c69efe
Add --no-hosts flag to eliminate use of /etc/hosts within containers
Users want to turn off addition of /etc/hosts file while building
container images, this would allow them to customize the /etc/hosts
file within the image.

Fixes: https://github.com/containers/buildah/issues/3808

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-10 08:52:28 -05:00
Morten Linderud 488e8654ea
docs: Remove Containerfile and containeringore
These where moved to buildah but because they are useful for podman and
the other tooling they are moved back into the common project.

Partially reverts a9e66ec72b

Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-02-22 21:14:33 +01:00
Giuseppe Scrivano 5a999cfbd5
buildah: new global option --cgroup-manager
allow to override the cgroup manager with a global option
--cgroup-manager=MANAGER that has the same semantic as Podman.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-02-14 14:39:21 +01:00
Daniel J Walsh 61579f4c83
Merge pull request #3745 from eriksjolund/fix_typos_and_improve_language
[CI:DOCS] Fix typos and improve language
2022-01-26 12:35:20 -05:00
OpenShift Merge Robot bed25d00cc
Merge pull request #3720 from Luap99/networks
buildah build --network add support for custom networks
2022-01-25 19:47:44 -05:00
Daniel J Walsh d92da92e4d
Update docs/buildah-build.1.md
Co-authored-by: Tom Sweeney <tsweeney@redhat.com>
2022-01-25 19:43:32 -05:00
Erik Sjölund 76e9dbf8a6 [CI:DOCS] Fix typos and improve language
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-01-25 21:55:55 +01:00
Paul Holzinger 08d636a28b
buildah bud --network add support for custom networks
The backend logic already supports specifying custom network names. This
only adds the support for the frontend parsing.

Fixes containers/podman#12282

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-25 21:02:43 +01:00
tomsweeneyredhat 8c250d495d Make pull commands be consistent
Per @edsantiago 's suggestion, make the pull commands consistent, always
accepting a value.  Currently we have:

--pull
--pull=true
--pull=false
--pull-never
--pull-always

With this changes, we will only have pull with a variety of options,
ala:

--pull
--pull=true
--pull=false
--pull=never
--pull=always

For backward compatibility, the --pull-never and --pull-always
options will remain operational, however they are not documented
and are conisdered deprecated.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2022-01-25 12:13:44 -05:00
Nalin Dahyabhai 652a8e1a52 docs/buildah-build.1.md: don't imply that -v isn't just a RUN thing
The current wording doesn't clearly state that volumes specified using
-v are only a factor when executing RUN instructions.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2022-01-24 17:24:43 -05:00
Paul Holzinger d7ccff3edb
Fix default CNI paths
We need to use the default from containers.conf and not hardcode them in
buildah. This fixes an issue with the cni network backend since it would
try to access /etc/cni/net.d/ even as rootless user. This regression was
introduced in commit f9cff07b81.

Also hide the cni flags as we do not expect users to change this. The
recommended way is to change them in containers.conf.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-10 15:49:43 +01:00
Aditya Rajan 719b660462
buildkit: add from field to bind and cache mounts so images can be used as source
Following commit adds buildkit like support for `from` field to `--mount=type=bind`
and `--mount=type=cache` so images and stage can be used as mount source.

Usage looks like
```dockerfile
RUN --mount=type=bind,source=.,from=<your-image>,target=/path ls /path
```
and
```dockerfile
RUN --mount=type=cache,from=<your-image>,target=/path ls /path
```

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2022-01-08 16:58:38 +05:30
OpenShift Merge Robot 080d8393f0
Merge pull request #3654 from MaximUltimatum/patch-1
[CI:DOCS] Simple README fix
2021-12-03 15:30:47 +01:00
Daniel J Walsh b480ce832f
Turn on rootless cgroupv2 tests
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-30 10:24:01 -05:00
Maximilien McDermott 2c366d1e54 Simple README fix
Signed-off-by: MaximUltimatum <mcder018@live.com>
2021-11-29 09:24:33 -06:00
Nalin Dahyabhai 40317d6237 docs/tutorials: update
Update tutorials to not expect `buildah run` to do anything if it isn't
given a command to run.  In some cases (including when we need to listen
for incoming connections when we might well not be root) this means we
use `podman run` instead.

Try to avoid using the terms container and image as though they're
interchangeable, which just creates confusion.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-11-15 14:35:55 -05:00
Nalin Dahyabhai 8651267bde Clarify that manifest defaults to localhost as the registry name
Clarify that --manifest also prepends localhost if no registry name is
included in the value, and check for duplicate values between tags and
the manifest name, which doesn't end well.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-11-15 13:18:45 -05:00
Daniel J Walsh a5d9f1cb28
Add --unsetenv option to buildah commit and build
This option will allow users to remove environment variables from the
final image.

Fixes: https://github.com/containers/buildah/issues/3512

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-09 16:17:21 -05:00
Nalin Dahyabhai 9f9f32cedd config: support the variant field
Add the variant field, along with methods for setting and querying it,
and expose them in the `buildah config` and `buildah inspect` commands.

When setting an initial architecture for a container based on an image
which doesn't contain an architecture, or from "scratch", normalize the
architecture name we've been given, and set both it and the variant
field at the same time.

Provide normalized architecture+variant values in `buildah info`.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-11-05 09:37:00 -04:00
Daniel J Walsh e1dd52ef44
Fix tutorial to specify command on buildah run line
Fixes: https://github.com/containers/buildah/issues/3564

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-04 03:59:41 -07:00
Aditya Rajan 5c216525ce
docs: Use guaranteed path for go-md2man
Its not guaranteed that host contains go-md2man so use the one which is
built by buildah.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-11-01 16:29:06 +05:30
Aditya Rajan fc69aa68c2
buildkit: add support for mount=type=cache
Following PR inroduces a new mount type=cache in parity to buildkit
which allows users to share persistant cache between different builds.

Allowing users to cache content generated by bussiness logic or enhance
build performance by caching components across builds.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-10-14 16:07:11 +05:30
Chris Evich 73b9f078b3
[CI:DOCS] Include manifest example usage
This duplicates https://github.com/containers/podman/pull/11889 which is
annoying, but there seems no easy way to avoid it.  The
commands/examples have been 'translated' for Buildah.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-10-11 16:58:50 -04:00
OpenShift Merge Robot 47c78dd60d
Merge pull request #3580 from jayaddison/docs/buildah-build-platform
docs: update buildah-build 'platform' option compatibility notes
2021-10-11 19:33:11 +02:00
James Addison f795888c56 docs: update buildah-from, buildah-pull 'platform' option compatibility notes
Signed-off-by: James Addison <jay@jp-hosting.net>
2021-10-10 17:26:45 +01:00
James Addison 57d665ee9c docs: update buildah-build 'platform' option compatibility notes
Signed-off-by: James Addison <jay@jp-hosting.net>
2021-10-10 11:31:58 +01:00
Daniel J Walsh 973976a662
De-dockerize the man page as much as possible
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-10-09 08:29:57 -04:00
TomSweeneyRedHat a5b553432d [CI:DOCS] Touch up Containerfile man page to show ARG can be 1st
The Containerfile man page says FROM must be the first statement
in the file.  However, that is not true as the ARG instruction can proceed it.

Addresses: #3555

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2021-10-08 16:04:10 -04:00
Aditya Rajan f1f008a086
docs: Fix and Update Containerfile man page with supported mount types
Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-10-08 17:25:55 +05:30
Aditya Rajan 70cfc09f7b
mount: add tmpcopyup to tmpfs mount option
Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-10-08 17:25:40 +05:30
Aditya Rajan f0d3140e5a
build: Add support for buildkit like --mount=type=bind
Following commit adds support for using buildkit like
`--mount=type=bind` with `RUN` statements. Mounts created by `--mount`
are transient in nature and only scoped to current RUN statements.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-10-06 13:45:53 +05:30
Daniel J Walsh 504fc77c7f
Fix .containerignore link file
Link file was miscreated as .containerfile rather then .containerignore.

We want man .containerignore and eventually man .dockerignore to point
to the containerignore.5.md man page.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-10-03 07:05:35 -04:00
Nalin Dahyabhai 100d5b12eb buildah build: add --all-platforms
Add a --all-platforms that instructs the builder to build for the
intersection of all platforms for which the build's base images are
available.  Returns an error if any of them aren't references to
manifest lists.  We've learned that we can't really trust architecture
and OS information stored in image config blobs, so we don't try to
salvage that case.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-09-29 15:43:46 -04:00
Daniel J Walsh a9e66ec72b
Add man page for Containerfile and .containerignore
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-29 11:19:10 -04:00
Giuseppe Scrivano 1cc85e7c59
push: support to specify the compression format
add two new flags to "buildah push" to allow tweaking the compression
format for the data layers.

The flag --compression-format allows users to specify the compression
algorithm to use.

With --compression-level it is possible to tweak the compression
level.

An image usage for partial pulls can be pushed with:

$ buildah push --compression-format zstd:chunked FOO

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-09-22 23:13:23 +02:00
Mario Loriedo 6468400446 Update 05-openshift-rootless-build.md
Replace buildah "build" command with "build-using-dockerfile"

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2021-09-10 11:20:07 +02:00
Chris Evich cb9b9d4dd5
Docs: Clarify rmi w/ manifest/index use
Also do some minor re-formatting of the `LIMITATIONS` section.  Reducing
the line-length, and formatting each paragraph into a bullet-item.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-09-07 16:12:02 -04:00
OpenShift Merge Robot 2c09b0725c
Merge pull request #3488 from siretart/patch-1
corrected man page section; .conf file to mention its man page
2021-08-31 06:25:43 -04:00
Reinhard Tartler 8f61fb2e3b corrected man page section; .conf file to mention its man page
Added as Debian distro patch.

[CI:DOCS]

Original-Author: Dmitry Smirnov <onlyjob@debian.org>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2021-08-31 09:20:34 +02:00
Reinhard Tartler 435eb9ffa5 Install new manpages to correct sections
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2021-08-29 21:28:53 +02:00
Daniel J Walsh 71e1ebf4bc
Add epoch time field to buildah images
Currently buildah images does not have an easy way to get the epoch
creation time. This field is available in `podman images` as the
Created field. Adding to buildah images to make it consistent.

Fixes: https://github.com/containers/buildah/issues/3478

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-08-26 06:23:15 -04:00
Kirill Shirinkin 2d822034f8 Rename bud to build, while keeping an alias for to bud.
Signed-off-by: Kirill Shirinkin <kirill@hey.com>
2021-08-25 17:56:58 +02:00
Nalin Dahyabhai 32c68951a4 imagebuildah: handle --manifest directly
When we're told to add built images to a manifest list, manipulate the
list ourselves, so that if we're creating a list, we won't have a
partially-populated list if some of the builds fail.

This also lets us include all of the platform information (including
variant info, which we can't sniff out after the fact) that we were
given when we started building the images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-17 11:05:28 -04:00
Nalin Dahyabhai 34d6ee13b8 imagebuildah: move multiple-platform building internal
Move multiple-platform build juggling logic from the CLI wrapper
directly into the imagebuildah package, to make using it easier for
packages that consume us as a library.

This requires reading Dockerfiles into byte slices so that we can
re-parse them for each per-platform build, rather than parsing them
directly, as we used to, since building modifies the parsed tree.

When building for multiple platforms, prefix progress log messages with
the platform description.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-11 15:24:56 -04:00
openshift-ci[bot] 88f55c8f15
Merge pull request #3409 from ashley-cui/sshagent
Implement SSH RUN mount
2021-08-06 22:35:40 +00:00
Ashley Cui 3a5635f90b Implement SSH RUN mount
Allow ssh socket from host or certain ssh keys to be exposed to a
certain RUN instruction, but not any other instructions, as well as not
showing up in the final image.
This is done by spawining a new agent from buildah and mounting
the listening socket inside the run. SSH_AUTH_SOCK inside the container
will be set to the socket mountpoint. The defualt mountpoint is
/run/buildkit/ssh_agent.{i}

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-08-06 09:00:06 -04:00
Nalin Dahyabhai ae08e01e49 bud: teach --platform to take a list
Add a pkg/parse.PlatformsFromOptions() which understands a "variant"
value as an optional third value in an OS/ARCH[/VARIANT] argument value,
which accepts a comma-separated list of them, and which returns a list
of platforms.

Teach "from" and "pull" about the --platform option and add integration
tests for them, warning if --platform was given multiple values.

Add a define.BuildOptions.JobSemaphore which an imagebuildah executor
will use in preference to one that it might allocate for itself.

In main(), allocate a JobSemaphore if the number of jobs is not 0 (which
we treat as "unlimited", and continue to allow executors to do).

In addManifest(), take a lock on the manifest list's image ID so that we
don't overwrite changes that another thread might be making while we're
attempting to make changes to it.  In main(), create an empty list if
the list doesn't already exist before we start down this path, so that
we don't get two threads trying to create that manifest list at the same
time later on.  Two processes could still try to create the same list
twice, but it's an incremental improvement.

Finally, if we've been given multiple platforms to build for, run their
builds concurrently and gather up their results.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-04 15:23:10 -04:00
OpenShift Merge Robot ec35bc428a
Merge pull request #3101 from vrothberg/source
buildah source - create and manage source images
2021-07-15 15:38:10 -04:00