In Copy(), instead of flagging a container not being mounted as an
error, do what we do in Run(), which is to mount it first and then
unmount when we're done.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Change copy behavior so that the destination can be a file rather than a
directory if we're copying a single item.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Always make sure the working directory exists before attempting to run
anything inside of it, and before attempting to copy contents into it or
one of its subdirectories.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
types.ImageSource.Close() can return an error now, and ParseImageName()
moved to containers/image/transports/alltransports.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When running our various subcommands, report errors that they return
correctly, and ensure that in those cases we don't exit with status 0.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Use the chrootarchive package instead of the archive package in the
implementation of "add", in an attempt to avoid problems with tarballs
with unusual paths in their headers.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When flags that we'd require be specified aren't, if there are command
line arguments, use their values as flag values.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Change the behavior of "from" to default to have --pull be true, rather
than the previous default of false.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Read the library defaults from the storage library before we parse our
command line, so that help output will correctly show the default
storage locations.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Don't mix "config" options in with the "run" and "commit" commands. It
might have made sense before "config" was a separate command, but it
doesn't any more, and it might suggest that settings changed during
"run" are temporary, when they are not.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Update the Usage strings that we include in Flag structures so that the
type of argument displayed in help output isn't just "value".
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Clarify that the --name option can also specify a container ID, and the
right things will still happen.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
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>
Clean up the tests so that data files that we generate don't get dropped
in the root directory of the host, or in a part of ${TMPDIR} that we
won't clean up. Add tests to exercise "add"'s extracting logic.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Simplify our implementation of copy/add to always assume that the
destination location will be a directory. Trying to be cleverer, like
cp is, would just be confusing.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Add "add" and "copy" CLI commands, which end up calling the same buildah
method, differing only in whether or not they tell it to attempt to
extract local sources when those sources appear to be archive files
("add" does, "copy" does not).
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When we're given the name of a container on the command line, make every
command that attempts to open an in-progress build container fall back
to creating a new build configuration file for the specified container
if the container exists but wasn't originally created for a build.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When we encounter an error parsing the target (new) image name during
"commit", don't use the container's name in the error message where we
meant to mention the image's name.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Move our data from the container's metadata to a file in the container's
per-container directory, so that we can use any OCI container as our
working container.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Default to mounting tmpfs over a container's volume mount points. Add a
RunOption for adding mounts to a run container, and use it as the
default set, adding any volume mounts and others that don't conflict
with them to it before running the container.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>