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
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
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
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
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
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
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
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
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
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
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
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
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
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
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>
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>