Commit Graph

28 Commits

Author SHA1 Message Date
Qiang Huang 146643f1f9 Merge pull request #595 from crosbymichael/masking
Update masked and ro paths
2016-03-01 11:14:20 +08:00
Alexander Morozov 9ae2ed1051 Merge pull request #591 from crosbymichael/exec-errors
Return proper exit code for exec errors
2016-02-26 19:58:47 -08:00
Michael Crosby a12336eb3e Update masked and ro paths
This updates the current list to what we have now in docker and also
makes these always added so that these are masked out.  Privileged
containers can always unmount these if they want to read from kcore or
something like that.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-26 15:54:53 -08:00
Michael Crosby 8d0a05b8dd Wait for pipes to write all data before exit
Add a waitgroup to wait for the io.Copy of stdout/err to finish before
existing runc.  The problem happens more in exec because it is really
fast and the pipe has data buffered but not yet read after the process
has already exited.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-26 12:14:47 -08:00
Michael Crosby 6bb653a6e8 Return proper exit code for exec errors
Exec erros from the exec() syscall in the container's init should be
treated as if the container ran but couldn't execute the process for the
user instead of returning a libcontainer error as if it was an issue in
the library.

Before specifying different commands like `/etc`, `asldfkjasdlfj`, or
`/alsdjfkasdlfj` would always return 1 on the command line with a
libcontainer specific error message.  Now they return the correct
message and exit status defined for unix processes.

Example:

```bash
root@deathstar:/containers/redis# runc start test
exec: "/asdlfkjasldkfj": file does not exist
root@deathstar:/containers/redis# echo $?
127
root@deathstar:/containers/redis# runc start test
exec: "asdlfkjasldkfj": executable file not found in $PATH
root@deathstar:/containers/redis# echo $?
127
root@deathstar:/containers/redis# runc start test
exec: "/etc": permission denied
root@deathstar:/containers/redis# echo $?
126
```

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-26 11:41:56 -08:00
rajasec b3661f4115 Removing tty0 tty1 from allowed devices
Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-16 11:21:00 +05:30
Kenfe-Mickael Laventure b011f80451 Prevent a panic when container fails to start
This occurs when the container was requested to be started in detached
mode and without a tty.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-02-16 15:18:49 -08:00
Julian Friedman 5fbdf6c3fc Register signal handlers earlier to avoid zombies
newSignalHandler needs to be called before the process is started, otherwise when
the process exits quickly the SIGCHLD is recieved (and ignored) before the
handler is set up. When this happens the reaper never runs, the
process becomes a zombie, and the exit code isn't returned to the user.

Signed-off-by: Julian Friedman <julz.friedman@uk.ibm.com>
2016-02-16 18:38:54 +00:00
Michael Crosby 45675581c1 Close tty on error before handler
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-10 13:41:35 -08:00
Doug Davis ad26ef1afc Create some util funcs that are common between start and exec
and it'll really help my start/create PR when I need to rebase  :-)

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-02-09 10:22:44 -08:00
Mrunal Patel bfd3345be9 Merge pull request #541 from crosbymichael/ids
Require container id as arg1
2016-02-10 08:14:36 +05:30
Antonio Murdaca 0dea09bce7 *: use coreos/go-systemd/activation for socket activation
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-02-09 23:44:09 +01:00
Michael Crosby a7278cad98 Require containerd id as arg 1
Closes #532

This requires the container id to always be passed to all runc commands
as arg one on the cli.  This was the result of the last OCI meeting and
how operations work with the spec.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-09 11:20:55 -08:00
Michael Crosby 3baae2d525 Update runc for devices changes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-08 13:15:12 -08:00
Mike Brown c2c0458598 merges latest spec with runc
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2016-02-05 12:47:09 -08:00
Michael Crosby fbc74c0eba Add detach and pid-file to restore
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-05 11:56:21 -08:00
Michael Crosby 1172a1e1e5 Update list command and created methods
We don't need a CreatedTime method on the container because it's not
part of the interface and can be received via the state.  We also do not
need to call it CreateTime because the type of this field is time.Time
so we know its time.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-28 13:32:24 -08:00
Michael Crosby 29b139f702 Move STDIO initialization to libcontainer.Process
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-10 16:11:49 -08:00
Eric Myhre 01d9b4002e Remove fatalf function; unused.
Signed-off-by: Eric Myhre <hash@exultant.us>
2015-10-21 19:22:14 -05:00
Mrunal Patel 5f65056c89 Update github.com/opecontainers/specs to 5b31bb2b77
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Make runc changes required to pull in the updated spec

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2015-08-03 15:33:48 -04:00
Jin-Hwan Jeong 628af083f8 typo: exists -> exits
Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>
2015-07-11 08:19:18 +09:00
Michael Crosby 845fc65e54 Create linux spec for runc spec command
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-07-02 13:45:56 -07:00
Michael Crosby f4c35e70d1 Depend on Spec types from specs repository
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-07-02 13:45:27 -07:00
Michael Crosby e15b86edb9 Add user struct based on spec implementation.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-07-02 13:45:27 -07:00
Marianna 5aa82c950d Enable build on unsupported platforms
Should compile now without errors but changes needed to be added for each system so it actually works.
main_unsupported.go is a new file with all the unsupported commands
Fixes #9

Signed-off-by: Marianna <mtesselh@gmail.com>
2015-06-29 17:03:44 -07:00
Michael Crosby b2d9d99610 Only define a single process
This removes the Processes slice and only allows for one process of the
container.  It also renames TTY to Terminal for a cross platform
meaning.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-06-29 13:30:35 -07:00
Zefan Li cbf3d12cb3 Remove nsinit from comments
Signed-off-by: Zefan Li <lizefan@huawei.com>
2015-06-24 11:29:50 +08:00
Michael Crosby 9fac183294 Initial commit of runc binary
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-06-21 19:34:13 -07:00