Commit Graph

23 Commits

Author SHA1 Message Date
Kir Kolyshkin af6b9e7fa9 nit: do not use syscall package
In many places (not all of them though) we can use `unix.`
instead of `syscall.` as these are indentical.

In particular, x/sys/unix defines:

```go
type Signal = syscall.Signal
type Errno = syscall.Errno
type SysProcAttr = syscall.SysProcAttr

const ENODEV      = syscall.Errno(0x13)
```

and unix.Exec() calls syscall.Exec().

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-04-18 16:16:49 -07:00
Dominik Süß 0b412e9482 various cleanups to address linter issues
Signed-off-by: Dominik Süß <dominik@suess.wtf>
2018-10-13 21:14:03 +02:00
Christy Perez 187d2d85be Moving the rest of runc to x/sys/unix
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
2017-05-22 17:36:02 -05:00
Antonio Murdaca d1a743674a
Ignore error when force deleting a non-existing container
This patch mimics the behavior of "rm -rf" so that if a container
doesn't exist and you force delete it, it won't error out.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-16 22:23:00 +02:00
Qiang Huang e0c7b6ceb7 Only allow single container operation
As per the discussions in #1156 , we think it's a bad
idea to allow multi container operations in runc. So
revert it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-03-08 10:02:39 +08:00
Mrunal Patel c54f1495e3 Fix error shadow and error check warnings
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-01-06 16:21:23 -08:00
Zhang Wei b517076907 Check args numbers before application start
Add a general args number validator for all client commands.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-11-29 11:18:51 +08:00
Michael Crosby e58671e530 Add --all flag to kill
This allows a user to send a signal to all the processes in the
container within a single atomic action to avoid new processes being
forked off before the signal can be sent.

This is basically taking functionality that we already use being
`delete` and exposing it ok the `kill` command by adding a flag.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-11-08 09:35:02 -08:00
allencloud f550f04f20 fix nits in stderr log
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-10-23 22:43:53 +08:00
Wang Long ed6c5c038c update the man for runc delete command
This patch also change the description in delete.go in order to
keep consistent with the mannual.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-10-18 12:18:10 +08:00
Wang Long 7e38b37e7c Delete: exit with non zero if one of the containers encountered an error
Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-10-08 11:28:56 +08:00
Wang Long d66ac3d9bd enhance runc delete command
This patch enhance the `runc delete` command as following

1) when `runc delete` without one container-id

```
$ runc delete
runc: "delete" requires a minimum of 1 argument
```

2) we can delete more containers at one command

for example:

```
$ runc list
ID          PID         STATUS      BUNDLE         CREATED
a           8490        created     /mycontainer   2016-09-18T03:49:32.259760434Z
b           8520        running     /mycontainer   2016-09-18T03:49:36.999299944Z
c           8535        created     /mycontainer   2016-09-18T03:49:40.975277538Z
d           8549        created     /mycontainer   2016-09-18T03:49:42.675282602Z
e           8562        running     /mycontainer   2016-09-18T03:49:44.175400931Z
$ runc delete a b cc
cannot delete container b that is not stopped: running
container cc is not exist
$ runc list
ID          PID         STATUS      BUNDLE         CREATED
b           8520        running     /mycontainer   2016-09-18T03:49:36.999299944Z
c           8535        created     /mycontainer   2016-09-18T03:49:40.975277538Z
d           8549        created     /mycontainer   2016-09-18T03:49:42.675282602Z
e           8562        running     /mycontainer   2016-09-18T03:49:44.175400931Z
$ runc delete -f b c d e
$ runc list
ID          PID         STATUS      BUNDLE      CREATED
```

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-09-18 11:59:55 +08:00
Kenfe-Mickael Laventure 9fc9d10e57 Add `--force` flag to `runc delete`
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-06-30 07:55:44 -07:00
Mrunal Patel a753b06645 Replace github.com/codegangsta/cli by github.com/urfave/cli
The package got moved to a different repository

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-06-06 11:47:20 -07:00
Michael Crosby 1d61abea46 Allow delete of created container
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-06-02 12:26:12 -07:00
Michael Crosby 6eba9b8ffb Fix SystemError and env lookup
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-05-31 11:10:47 -07:00
Michael Crosby 88dcf1d686 Kill container on delete
If the container's state is `created` when runc delete is called make
sure that the init is killed before deleting the on system state.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-05-31 11:06:41 -07:00
Zhao Lei 8cd952f0a2 manual: Unify EXAMPLE title in code and manual
There are 3 types of EXAMPLE title in manual and code:
1: "# EXAMPLE"
   runc-delete.8.md
   runc-exec.8.md
   runc-kill.8.md
2: "EXAMPE:"
   runc-spec.8.md
3: EXAMPLE title exist in manual, but not exist in code's --help output
   delete.go
   exec.go
   kill.go

This patch unified above format, and deleted some useless blanks.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
2016-05-25 10:48:11 +08:00
Qiang Huang 8477638aab Update cli package
The old one has bug when showing help message for IntFlags.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-05-10 13:58:09 +08:00
Amit Krishnan 82050a5b8f Get runc to build clean on Solaris
Signed-off-by: Amit Krishnan <krish.amit@gmail.com>
2016-04-12 16:13:08 -07:00
Michael Crosby fb0dfe068c Remove container root dir from an aborted start
If runc was SIGKILL'd or something happened and the container was not
able to start and runc died as well then we could get into the state
where `$root/<containerid>` exists but `$root/<containerid>/state.json`
does not.  This will not allow libcontainer to load the container to
call the delete function as it has no data on the container other than
its id.  We should just remove it in runc so that that system matches
what runc sees for the container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-29 10:27:19 -07:00
Mike Brown f4e37ab63e updating usage for runc and runc commands
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2016-02-17 09:00:39 -06:00
Michael Crosby bb6a747825 Add detach to runc
By adding detach to runc the container process is the only thing running
on the system is the containers process.
This allows better usage of memeory and no runc process being long
lived.  With this addition you also need a delete command because the
detached container will not be able to remove state and the left over
cgroups directories.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-28 13:35:13 -08:00