Commit Graph

13 Commits

Author SHA1 Message Date
Nalin Dahyabhai 3748b31c04 Defaul to the configured hostname in Run()
If Run() isn't passed a hostname to set, but we have one that was set
directly or inherited from the source image, use that value.

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

Closes: #121
Approved by: rhatdan
2017-05-31 20:12:07 +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
Nalin Dahyabhai b7a598ca21 Fixup metalinter errors
Fix a number of issues flagged by gometalinter.

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

Closes: #62
Approved by: rhatdan
2017-04-12 21:25:35 +00:00
Nalin Dahyabhai 96d15578e4 Fixup golint warnings
Fix a number of issues flagged by golint.

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

Closes: #62
Approved by: rhatdan
2017-04-12 21:25:35 +00:00
Nalin Dahyabhai b1bb73e01c Teach "Run" to dig user IDs out of containers
When we have cgo, use fgetpwent() to try to look up user IDs and primary
GIDs in containers.  If that fails for any reason (or if we don't have
cgo), fall back to doing what we were doing before (i.e., trying to look
up the information on the host).

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

Closes: #63
Approved by: rhatdan
2017-04-11 18:41:54 +00:00
Nalin Dahyabhai ccfa6a8bd4 Make Run() use a terminal only if it has one
Make Run() default to running the command with a PTY if we're being run
with stdout connected to terminal, and provide options to force the
decision one way or the other.

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

Closes: #64
Approved by: rhatdan
2017-04-11 16:55:52 +00:00
Nalin Dahyabhai e96ba381a2 Add some more options for Run
Add options to Run() for passing in additional environment variables,
overriding the default command, user, and working directory, and a flag
for controlling whether or not we attach to the host's network.

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

Closes: #46
Approved by: rhatdan
2017-03-27 19:07:38 +00:00
Nalin Dahyabhai c6a4a06454 Bind mount /etc/hosts, /etc/resolv.conf in Run()
When we run a command in Run(), since it's sharing the host's network
namespace, also have it share the host's DNS settings.

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

Closes: #34
Approved by: rhatdan
2017-03-24 20:37:06 +00:00
Nalin Dahyabhai e202577172 Make Run() commands share the host's network
Make commands we run in Run() use the host's networking.

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

Closes: #34
Approved by: rhatdan
2017-03-24 20:37:06 +00:00
Nalin Dahyabhai ae1fffb3fd Always make sure the working directory exists
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>
2017-03-23 14:57:00 -04:00
Nalin Dahyabhai 691266d40c Handle volumes in "run"
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>
2017-02-17 13:58:34 -05:00
Nalin Dahyabhai c46716525c Make the runtime for "run" more configurable
Provide RunOptions which can be used to change the runtime to something
other than "runc", and add an option that allows passing in additional
global arguments for the runtime.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-17 13:58:11 -05:00
Nalin Dahyabhai 2963474e17 Add a "run" command, using runc
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-13 17:21:45 -05:00