public function execCreate($container, $cmd, $tty = false, $stdin = false, $stdout = true, $stderr = true, $user = '', $privileged = false)
    {
        if (!is_array($cmd)) {
            $cmd = array('sh', '-c', (string)$cmd);
        }

        return $this->postJson(
            $this->uri->expand(
                '/containers/{container}/exec',
                array(
                    'container' => $container
                )
            ),
            array(
                'Cmd' => $cmd,
                'Tty' => !!$tty,
                'AttachStdin' => !!$stdin,
                'AttachStdout' => !!$stdout,
                'AttachStderr' => !!$stderr,
                'User' => $user,
                'Privileged' => !!$privileged,
            )
        )->then(array($this->parser, 'expectJson'));
    }
public function execCreate($container, $cmd, $tty = false, $stdin = false, $stdout = true, $stderr = true, $user = '', $privileged = false)
    {
        if (!is_array($cmd)) {
            $cmd = array('sh', '-c', (string)$cmd);
        }

        return $this->postJson(
            $this->uri->expand(
                '/containers/{container}/exec',
                array(
                    'container' => $container
                )
            ),
            array(
                'Cmd' => $cmd,
                'Tty' => !!$tty,
                'AttachStdin' => !!$stdin,
                'AttachStdout' => !!$stdout,
                'AttachStderr' => !!$stderr,
                'User' => $user,
                'Privileged' => !!$privileged,
            )
        )->then(array($this->parser, 'expectJson'));
    }
public function execCreate ( $ container , $ cmd , $ tty = false , $ stdin = false , $ stdout = true , $ stderr = true , $ user = '' , $ privileged = false ) { if ( ! is_array ( $ cmd ) ) { $ cmd = array ( 'sh' , '-c' , ( string ) $ cmd ) ; } return $ this -> postJson ( $ this -> uri -> expand ( '/containers/{container}/exec' , array ( 'container' => $ container ) ) , array ( 'Cmd' => $ cmd , 'Tty' => ! ! $ tty , 'AttachStdin' => ! ! $ stdin , 'AttachStdout' => ! ! $ stdout , 'AttachStderr' => ! ! $ stderr , 'User' => $ user , 'Privileged' => ! ! $ privileged , ) ) -> then ( array ( $ this -> parser , 'expectJson' ) ) ; }
Sets up an exec instance in a running container id

The $command should be given as an array of strings (the command plus
arguments). Alternatively, you can also pass a single command line string
which will then be wrapped in a shell process.

The TTY mode should be set depending on whether your command needs a TTY
or not. Note that toggling the TTY mode affects how/whether you can access
the STDERR stream and also has a significant impact on performance for
larger streams (relevant for 100 MiB and above). See also the TTY mode
on the `execStart*()` call:
- create=false, start=false:
STDOUT/STDERR are multiplexed into separate streams + quite fast.
This is the default mode, also for `docker exec`.
- create=true,  start=true:
STDOUT and STDERR are mixed into a single stream + relatively slow.
This is how `docker exec -t` works internally.
- create=false, start=true
STDOUT is streamed, STDERR can not be accessed at all + fastest mode.
This looks strange to you? It probably is. See also the benchmarking example.
- create=true, start=false
STDOUT/STDERR are multiplexed into separate streams + relatively slow
This looks strange to you? It probably is. Consider using the first option instead.

@param string       $container  container ID
@param string|array $cmd        Command to run specified as an array of strings or a single command string
@param boolean      $tty        TTY mode
@param boolean      $stdin      attaches to STDIN of the exec command
@param boolean      $stdout     attaches to STDOUT of the exec command
@param boolean      $stderr     attaches to STDERR of the exec command
@param string|int   $user       user-specific exec, otherwise defaults to main container user (requires API v1.19+ / Docker v1.7+)
@param boolean      $privileged privileged exec with all capabilities enabled (requires API v1.19+ / Docker v1.7+)
@return PromiseInterface Promise<array> with exec ID in the form of `array("Id" => $execId)`
@link https://docs.docker.com/reference/api/docker_remote_api_v1.15/#exec-create
Sets up an exec instance in a running container id