Commit Graph

41 Commits

Author SHA1 Message Date
Miloslav Trmač 797e618cbe Update c/image to v4.0.1
This requires updating all import paths throughout.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1891
Approved by: vrothberg
2019-10-04 07:34:03 +00:00
Daniel J Walsh e58b898962 Move devices code to unit specific directory.
This change is required to allow podman for windows to build.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1855
Approved by: TomSweeneyRedHat
2019-09-13 11:13:10 +00:00
Daniel J Walsh 20a33e0791 Add --devices flag to bud and from
Some Dockerfiles (fuse-overlay) require additional devices to be in the
build environment.

This patch allows the user to specify additional devices.

Also I noticed that CapAdd and CapDrop was not working in buildah bud situations,
so this patch also fixes this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1820
Approved by: @TomSweeneyRedHat
2019-09-07 17:32:43 +00:00
Matthew Heon ab0286f7e3 Add security-related volume options to validator
Also, ensure ordering is correct on other entries. The current
code will increment *after* checking for validity in some cases,
which allows such options as '-v /tmp:/test1:ro,rw' to pass
validation when they obviously don't make much sense.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>

Closes: #1794
Approved by: rhatdan
2019-08-16 10:54:18 +00:00
Giuseppe Scrivano 1ac63a264d rootless, overlay: use fuse-overlayfs
when running in rootless mode, use fuse-overlayfs for mounting the
overlay file system on the host.  Then create a bind mount inside the
container.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1743
Approved by: rhatdan
2019-07-29 23:46:00 +00:00
Sascha Grunert 6b214d2921 Add golint linter and apply fixes
This commit enabled to golint linter in golangci-lint and applies all
necessary fixes.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>

Closes: #1740
Approved by: rhatdan
2019-07-27 09:45:49 +00:00
Nalin Dahyabhai be51b9bd24 Update to match updated runtime-tools API
Some method argument types changed in runtime-tools. Compensate.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #1720
Approved by: vrothberg
2019-07-17 12:41:32 +00:00
Qi Wang 130cf4516f Add --mount for buildah run
support mount type of bind and tmpfs

Signed-off-by: Qi Wang <qiwan@redhat.com>

Closes: #1673
Approved by: rhatdan
2019-07-02 08:48:55 +00:00
Qi Wang 0f7f7a1a9d import method ValidateVolumeOpts from libpod
move ValidateVolumeOpts from libpod to buildah so libpod can vendor it in.

Signed-off-by: Qi Wang <qiwan@redhat.com>

Closes: #1698
Approved by: rhatdan
2019-06-29 10:00:13 +00:00
Jordan Webb 5892f9db57 Support --dns=none like podman
Signed-off-by: Jordan Webb <jordemort@github.com>

Closes: #1649
Approved by: giuseppe
2019-06-11 07:20:50 +00:00
Qi Wang 78dcf2fdaf fix bug --cpu-shares parsing typo
close #1464

fix the paring typo cpu-shared of --cpu-shares.
fix expect value in from.bats

Signed-off-by: Qi Wang <qiwan@redhat.com>

Closes: #1662
Approved by: TomSweeneyRedHat
2019-06-10 20:14:13 +00:00
Daniel J Walsh bcc5e51a94 Add support for Overlay volumes into the container.
Overlay mounts allow buildah bud and buildah from to
specify a directory on the disk that will be mounted
as an overlay into the container, where the overlay can be written to
but when the RUN or buildah run exits, the modified files will dissapear.

The basic idea is to be able to mount cache from the disk for things like yum/dnf/apt
to be able to be used and modified in the contianer on a run command, but to be
kept fresh for each RUN.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1560
Approved by: giuseppe
2019-05-20 12:54:10 +00:00
Daniel J Walsh 3a30a6f8d8 Export buildah validate volume functions so it can share code with libpod
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1560
Approved by: giuseppe
2019-05-20 12:54:10 +00:00
Qi Wang 59da11d4b4 add buildah login/logout & fix authfile path
Fix the bug that buildah reads /var/run/containers.. as authentication file.(in readme files it should be /run/containers/uid).
Add `buildah login`, `buildah logout` to close #1329, enable to use buildah login before running buildah bud for multi-stage bud and avoiding using --creds flag.

Signed-off-by: Qi Wang <qiwan@redhat.com>

Closes: #1501
Approved by: rhatdan
2019-05-02 21:59:12 +00:00
Daniel J Walsh 0e30da6de0 Fix Transient Mounts
buildah bud is ignoring --volumes flag.

This patch parses the volumes and then passes them into the builder to be used.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1559
Approved by: vrothberg
2019-04-29 12:05:39 +00:00
baude 34e7eba408 allow podman to build a client for windows
the podman remote-client for windows pulls in some buildah code for
things like commit and build.  we need to perform some slight
refactoring of buildah code to accomodate that build.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #1551
Approved by: rhatdan
2019-04-26 19:16:11 +00:00
James Cassell cd1b62a9ad auto pass http_proxy to container
- pass all proxy env vars
- --http-proxy option for bud and from
- bash_completion and docs

Signed-off-by: James Cassell <code@james.cassell.me>

Closes: #1525
Approved by: giuseppe
2019-04-17 14:33:46 +00:00
Qi Wang d43787be28 add --dns* flags to buildah bud
use --dns* flags to change /etc/resolv.conf in the container during the build.
Signed-off-by: Qi Wang <qiwan@redhat.com>

Closes: #1491
Approved by: rhatdan
2019-04-12 21:01:30 +00:00
Daniel J Walsh 6544c55416 Fix handling of Slices versus Arrays
Cobra does not allow a "," in a StringSlice, so we should
be using StringArrays.  This fixes issues with setting
security-opts level flags.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1467
Approved by: TomSweeneyRedHat
2019-04-05 01:00:20 +00:00
Giuseppe Scrivano c6ae5c5a0c rootless: by default use the host network namespace
if --net is not specified, default to use the host network namespace.

It is still possible to use slirp4netns with --network container.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1690209

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1421
Approved by: rhatdan
2019-03-21 18:21:22 +00:00
Giuseppe Scrivano 042a249e73
rootless: honor --net host
when running in rootless mode, do not use slirp4netns if --net host is
specified.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-12 13:48:02 +01:00
TomSweeneyRedHat ce311f7038 Fix tls-verify polarity
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Fix the polarity of tls-verify, during the Cobra conversion
it was inadvertently flipped.

At least partially addresses: #1332

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #1351
Approved by: rhatdan
2019-02-20 17:34:15 +00:00
baude 3e175b1f7a Replace urfave/cli with cobra
Signed-off-by: baude <bbaude@redhat.com>

Closes: #1303
Approved by: rhatdan
2019-02-01 01:52:50 +00:00
Miloslav Trmač 9c65e5699c Update for sysregistriesv2 API changes
Mostly this is a straightforward elimination of manual GetRegistries calls.

In getCopyOptions, we just remove setting the DockerInsecureSkipTLSVerify
values because the docker:// tranport now does that automatically.  (This
actually changes behavior, because docker:// supports namespace prefixes
in addition to matching only by hostnames, but that's a superset of the
previous behavior.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1214
Approved by: rhatdan
2018-12-03 20:07:00 +00:00
Zhou Hao 3062ecb605 parse: Modify the return value
Code optimization and modification of return values.

Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #1067
Approved by: rhatdan
2018-10-08 10:35:32 +00:00
Zhou Hao a791c2662d parse: modify the verification of the isolation value
To verify the value of the isolation, verify that all strings are the same, not just the beginning of the string.
Avoid users mistakenly thinking that the wrong value entered is also a correct value.

```
➜  buildah git:(isolation-fix) ✗ buildah from --isolation chrootcc cc510acfcd70
fedora-working-container-7
```

After Change:
```
➜  buildah git:(isolation-fix) ✗ ./buildah from --isolation chrootcc cc510acfcd70
unrecognized isolation type "chrootcc"
ERRO[0000] exit status 1
```

Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #1067
Approved by: rhatdan
2018-10-08 10:35:32 +00:00
Nalin Dahyabhai 62c01da3e4 Correctly set DockerInsecureSkipTLSVerify when pulling images
The image library's copy routine doesn't itself consult the registries
configuration in order to decide whether or not to disable TLS
verification when communicating with a registry, so it's on us to use
the name of a source or destination image to decide whether to set the
flag for that behavior.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #1056
Approved by: rhatdan
2018-10-05 15:30:11 +00:00
Daniel J Walsh ba012ddec6
Move buildah from projecatatomic/buildah to containers/buildah
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-09-18 08:06:11 -04:00
Nalin Dahyabhai 40bb4a5b47 Add a value for IsolationOCIRootless
Add a new Isolation value: IsolationOCIRootless, for which we add a
global --rootless=true flag and a local --no-new-keyring flag when
creating a runtime container, and make some changes to the mounts list,
default namespacing configurations, and supplemental groups list.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #873
Approved by: rhatdan
2018-08-03 19:49:19 +00:00
Nalin Dahyabhai 35a37f36d3 chroot: handle raising process limits
When using chroot isolation, if we're configured to raise any process
limits above their current values, do so in the grandparent process,
before it transfers execution to a child that it starts in a user
namespace, which won't have the privileges to do so.

The child can still lower resource limits and set limits to the values
that it inherited, so let it continue to do so.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #891
Approved by: rhatdan
2018-08-03 09:02:08 +00:00
Daniel J Walsh a2b018430d Set the default ulimits to match Docker
We want to set the maximum number of processes and number of open files
to match the Docker defaults.

nofile=1048576:1048576, nproc=1048576:1048576

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #891
Approved by: rhatdan
2018-08-03 09:02:08 +00:00
Nalin Dahyabhai 38ef1231f2 Add and implement IsolationChroot
Add an IsolationChroot that trades flexibility and isolation for being
able to do what it does in a host environment that's already isolated to
the point where we're not allowed to set up some of that isolation,
producing a result that leans more toward chroot(1) than runc(1) does.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #836
Approved by: rhatdan
2018-08-01 14:04:59 +00:00
Nalin Dahyabhai 29359f0d0b Implement basic recognition of the "--isolation" option
Add the basics of handling the "--isolation" option, though at the
moment, the only recognized option is "oci", which is our default.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #822
Approved by: rhatdan
2018-06-26 22:37:38 +00:00
Giuseppe Scrivano fc341c5382 buildah: set the HTTP User-Agent
Closes: https://github.com/projectatomic/buildah/issues/573

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #814
Approved by: rhatdan
2018-06-25 13:17:39 +00:00
Nalin Dahyabhai da7be32737 Use the right formatting when adding entries to /etc/hosts
Append address+"\t"+hostname to the hosts file instead of the
"hostname:address" format that we picked up from the command line.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #798
Approved by: rhatdan
2018-06-19 18:47:41 +00:00
Nalin Dahyabhai 0a8bdef96c Allow --userns-uid-map/--userns-gid-map to be global options
Allow --userns-uid-map and --userns-gid-map to be specified as global
options, which can be overridden by options specified to commands which
know them as non-global options.

This will mainly benefit tools that want to set ID mappings for buildah
to use, but which don't want to have to figure out whether or not
they're invoking it with a subcommand that recognizes these options.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #803
Approved by: rhatdan
2018-06-19 16:52:55 +00:00
Daniel J Walsh 0bd560c369 Move parsing code out of common for namespaces and into pkg/parse.go
podman needs this code to be vendored in for podman build.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #761
Approved by: rhatdan
2018-06-07 12:34:44 +00:00
Nalin Dahyabhai 1ad8dc0c24 Documentation fixes
Update some comments and a couple of man pages.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #709
Approved by: rhatdan
2018-05-18 19:58:31 +00:00
Zhou Hao 906ee37d16 buildah-from: add effective value to mount propagation
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #661
Approved by: rhatdan
2018-05-07 14:05:52 +00:00
umohnani8 e6b6c9fc2d Validate host and container paths passed to --volume
Print proper error message if the host or container paths
are relative paths. Only absolute paths are allowed.
Fix the buildah run documentation for the --volume flag
and add an example.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #643
Approved by: rhatdan
2018-04-30 19:57:07 +00:00
baude 49abf8264e Refactor buildah bud for vendoring
Projects like libpod would benefit greatly if we could vendor in buildah
rather than execing it.  This refactor moves some of the key parsing
functions that buds uses to pkg/parse so that the project vendoring
buildah can also benefit from them.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #608
Approved by: rhatdan
2018-04-24 20:08:51 +00:00