Commit Graph

23 Commits

Author SHA1 Message Date
Boaz Shuster 815cedfc71 Trim the image reference to just its name before calling getImageName
When setting a container name the getImageName function goes through
all the names of the resolved image and finds the name that contains
the given name by the user.

However, if the user is specifying "docker.io/tagged-image"
the Docker transport returns "docker.io/library/tagged-image" which
makes getImageName returns the original image name because it does
not find a match.

To resolve this issue before calling getImageName the image given
by the user will be trimmed to be just the name.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #422
Approved by: rhatdan
2018-02-04 11:26:43 +00:00
Boaz Shuster b68f88c53d Fix: setting the container name to the image
In commit 47ac96155f the image name that is used
for setting the container name is taken from the resolved image
unless it is empty.

The image has the "Names" field and right now the first name is
taken. However, when the image is a tagged image, the container name
will end up using the original name instead of the given one.

For example:

$ buildah tag busybox busybox1
$ buildah from busybox1

Will set the name of the container as "busybox-working-container"
while it was expected to be "busybox1-working-container".

This patch fixes this particular issue.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #399
Approved by: rhatdan
2018-01-26 08:07:58 +00:00
Boaz Shuster ad49b24d0b Return a better error message when failed to resolve an image
During the creation of a new builder object there are errors
that are only logged into "logrus.Debugf".

If in the end of the process "ref" or "img" are nil and "options.FromImage"
is set then it means that there was an issue.
By default, it was assumed that the image name is wrong. Yet,
this assumption isn't always correct. For example, it might fail due to
authorization or connection errors.

In this patch, I am attempting to fix this problem by checking the
last error stored in the "err" variable and returning the cause
of the failure.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #406
Approved by: rhatdan
2018-01-24 14:03:28 +00:00
Nalin Dahyabhai 47ac96155f Use configured registries to resolve image names
When locating an image for pulling, inspection, or pushing, if we're
given an image name that doesn't include a domain/registry, try building
a set of candidate names using the configured registries as domains, and
then pull/inspect/push using the first of those names that works.

If a name that we're given corresponds to a prefix of the ID of a local
image, skip completion and use the ID directly instead.

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

Closes: #360
Approved by: rhatdan
2017-12-14 22:21:16 +00:00
Daniel J Walsh 58025ee1be Ignore errors when trying to read containers buildah.json
Since containers can be created using other tools then buildah
we can not fail when they don't have buildah config.

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

Closes: #327
Approved by: nalind
2017-11-16 21:12:38 +00:00
Daniel J Walsh 3e8ded8646 Add secrets patch to buildah
Signed-off-by: umohnani8 <umohnani@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-11-08 00:01:57 +00:00
Daniel J Walsh 966f32b2ac Add proper SELinux labeling to buildah run
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #294
Approved by: nalind
2017-11-07 22:40:29 +00:00
Daniel J Walsh 8ecefa978c Vendor in changes to support sirupsen/logrus
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-10 17:30:11 +00:00
Nalin Dahyabhai 9327431e97 Avoid trying to print a nil ImageReference
When we fail to pull an image, don't try to include the name of the
image that pullImage() returned in the error text - it will have
returned nil for the pulled reference in most cases.  Instead, use the
name of the image as we were told it.

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

Closes: #255
Approved by: nalind
2017-08-31 21:24:35 +00:00
Daniel J Walsh 52087ca1c5 Remove --transport flag
This is no simpler then putting the transport in the image page,
we should default to the registry specified in containers/image
and not override it.  People are confused by this option, and I
see no value.

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

Closes: #234
Approved by: rhatdan
2017-08-29 10:37:54 +00:00
Nalin Dahyabhai 94f2bf025a Replace --registry with --transport
Replace --registry command line flags with --transport.  For backward
compatibility, add Transport as an addtional setting that we prepend to
the still-optional Registry setting if the Transport and image name
alone don't provide a parseable image reference.

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

Closes: #235
Approved by: rhatdan
2017-08-03 15:55:13 +00:00
Nalin Dahyabhai 262b43a866 Improve "from" behavior with unnamed references
Fix our instantiation behavior when the source image reference is not a
named reference.

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

Closes: #235
Approved by: rhatdan
2017-08-03 15:55:13 +00:00
Dan Walsh 8ced1276e5 Change functions that use a fmt.Errorf to wrap an err to error.Wrapf
Impove error reporting by wrapping all returned err functions with
error.Wrapf

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

Closes: #124
Approved by: nalind

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

Closes: #125
Approved by: nalind
2017-06-02 14:17:04 +00:00
Dan Walsh 59dfec35c3 buildah mount command should list mounts when no arguments are given.
buildah mount should work like the mount command and list all mount points
when no options are specified.

Need buildah umount to remove mount point from the database when a mount point
is umounted.

Also remove Mounts field from the builder object.  We only support a single mount
point so no reason for this field any longer.

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

Closes: #124
Approved by: nalind
2017-06-01 18:37:40 +00:00
Nalin Dahyabhai fc880bcc86 Maintain multiple working container configs
Maintain the container configuration in multiple formats in the Buildah
object, initializing one based on the other, depending on which format
the source image used for its configuration.

Replace directly manipulated fields in the Buildah object (Annotations,
CreatedBy, OS, Architecture, Maintainer, User, Workdir, Env, Cmd,
Entrypoint, Expose, Labels, and Volumes) with accessor functions which
update both configurations and which read from whichever one we consider
to be authoritative.  Drop Args because we weren't using them.

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

Closes: #102
Approved by: rhatdan
2017-05-18 18:28:44 +00:00
Dan Walsh 95c2a2d99c Vendor in containers/storage and containers/image
Signed-off-by: Dan Walsh <dwalsh@redhat.com>

Closes: #103
Approved by: nalind
2017-05-17 21:19:24 +00:00
Nalin Dahyabhai cbeb888e30 Clean up image pulling policy
Change how we represent image pulling policy from a pair of booleans to
a single field which can take three values (never, if-missing, always),
with the default value being if-missing.

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

Closes: #71
Approved by: rhatdan
2017-04-17 18:16:13 +00:00
Nalin Dahyabhai bed75252b0 Use imagebuilder's definition of "scratch"
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #59
Approved by: rhatdan
2017-04-13 21:42:51 +00:00
Nalin Dahyabhai 4c982a3799 Strip the image name down more for container names
When computing a default container name from the name of a source image,
drop tags and any leading components from the image name before
attempting to use it as part of a container name.

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

Closes: #33
Approved by: rhatdan
2017-03-27 19:22:36 +00:00
Daniel J Walsh 80f73013cd Remove link from CLI
We have decided not to support using the --link param in the CLI.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-03-23 14:59:20 -04:00
Nalin Dahyabhai a64f7d1187 Better distinguish between image names and IDs
When recording the origins of working containers, take better care to
distinguish between image names and IDs.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-15 17:29:18 -04:00
Nalin Dahyabhai 20f2cb9dbe Fix a number of issues flagged by golint
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-10 14:46:09 -05:00
Nalin Dahyabhai 0ab0890e4e Massive refactoring
Pull most of the core logic from the CLI into a package that should be
easier to consume as a library.  Add a "config" command that updates the
builder object's configuration.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-10 11:48:15 -05:00