conmon needs to support --detach and non --detach mode
In podman exec we want to maintain the tty with the container. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
6c0b79b706
commit
159a6d1ecb
3 changed files with 22 additions and 3 deletions
|
@ -2,6 +2,15 @@ language: go
|
||||||
|
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
# If the latest unstable development version of go fails, that's OK.
|
||||||
|
allow_failures:
|
||||||
|
- go: tip
|
||||||
|
|
||||||
|
# Don't hold on the tip tests to finish. Mark tests green if the
|
||||||
|
# stable versions pass.
|
||||||
|
fast_finish: true
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ static bool opt_systemd_cgroup = false;
|
||||||
static bool opt_no_pivot = false;
|
static bool opt_no_pivot = false;
|
||||||
static char *opt_exec_process_spec = NULL;
|
static char *opt_exec_process_spec = NULL;
|
||||||
static bool opt_exec = false;
|
static bool opt_exec = false;
|
||||||
|
static bool opt_detach = false;
|
||||||
static char *opt_log_path = NULL;
|
static char *opt_log_path = NULL;
|
||||||
static char *opt_exit_dir = NULL;
|
static char *opt_exit_dir = NULL;
|
||||||
static int opt_timeout = 0;
|
static int opt_timeout = 0;
|
||||||
|
@ -126,6 +127,7 @@ static GOptionEntry opt_entries[] =
|
||||||
{ "pidfile", 'p', 0, G_OPTION_ARG_STRING, &opt_pid_file, "PID file", NULL },
|
{ "pidfile", 'p', 0, G_OPTION_ARG_STRING, &opt_pid_file, "PID file", NULL },
|
||||||
{ "systemd-cgroup", 's', 0, G_OPTION_ARG_NONE, &opt_systemd_cgroup, "Enable systemd cgroup manager", NULL },
|
{ "systemd-cgroup", 's', 0, G_OPTION_ARG_NONE, &opt_systemd_cgroup, "Enable systemd cgroup manager", NULL },
|
||||||
{ "exec", 'e', 0, G_OPTION_ARG_NONE, &opt_exec, "Exec a command in a running container", NULL },
|
{ "exec", 'e', 0, G_OPTION_ARG_NONE, &opt_exec, "Exec a command in a running container", NULL },
|
||||||
|
{ "detach", 'd', 0, G_OPTION_ARG_NONE, &opt_detach, "When execing into the container do so in detached mode", NULL },
|
||||||
{ "exec-process-spec", 0, 0, G_OPTION_ARG_STRING, &opt_exec_process_spec, "Path to the process spec for exec", NULL },
|
{ "exec-process-spec", 0, 0, G_OPTION_ARG_STRING, &opt_exec_process_spec, "Path to the process spec for exec", NULL },
|
||||||
{ "exit-dir", 0, 0, G_OPTION_ARG_STRING, &opt_exit_dir, "Path to the directory where exit files are written", NULL },
|
{ "exit-dir", 0, 0, G_OPTION_ARG_STRING, &opt_exit_dir, "Path to the directory where exit files are written", NULL },
|
||||||
{ "log-path", 'l', 0, G_OPTION_ARG_STRING, &opt_log_path, "Log file path", NULL },
|
{ "log-path", 'l', 0, G_OPTION_ARG_STRING, &opt_log_path, "Log file path", NULL },
|
||||||
|
@ -1250,10 +1252,17 @@ int main(int argc, char *argv[])
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (opt_exec) {
|
if (opt_exec) {
|
||||||
add_argv(runtime_argv,
|
if (opt_detach) {
|
||||||
"exec", "-d",
|
add_argv(runtime_argv,
|
||||||
|
"exec", "-d"
|
||||||
"--pid-file", opt_pid_file,
|
"--pid-file", opt_pid_file,
|
||||||
NULL);
|
NULL);
|
||||||
|
} else {
|
||||||
|
add_argv(runtime_argv,
|
||||||
|
"exec",
|
||||||
|
"--pid-file", opt_pid_file,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
add_argv(runtime_argv,
|
add_argv(runtime_argv,
|
||||||
"create",
|
"create",
|
||||||
|
|
|
@ -172,6 +172,7 @@ func (r *Runtime) CreateContainer(c *Container, cgroupParent string) (err error)
|
||||||
if r.cgroupManager == SystemdCgroupsManager {
|
if r.cgroupManager == SystemdCgroupsManager {
|
||||||
args = append(args, "-s")
|
args = append(args, "-s")
|
||||||
}
|
}
|
||||||
|
args = append(args, "-d")
|
||||||
args = append(args, "-c", c.id)
|
args = append(args, "-c", c.id)
|
||||||
args = append(args, "-u", c.id)
|
args = append(args, "-u", c.id)
|
||||||
args = append(args, "-r", r.Path(c))
|
args = append(args, "-r", r.Path(c))
|
||||||
|
@ -427,7 +428,7 @@ func (r *Runtime) ExecSync(c *Container, command []string, timeout int64) (resp
|
||||||
args = append(args, "-c", c.id)
|
args = append(args, "-c", c.id)
|
||||||
args = append(args, "-r", r.Path(c))
|
args = append(args, "-r", r.Path(c))
|
||||||
args = append(args, "-p", pidFile.Name())
|
args = append(args, "-p", pidFile.Name())
|
||||||
args = append(args, "-e")
|
args = append(args, "-e", "-d")
|
||||||
if c.terminal {
|
if c.terminal {
|
||||||
args = append(args, "-t")
|
args = append(args, "-t")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue