# How to stdin in docker execstart in docker-php api

**URL:** <https://forums.docker.com/t/how-to-stdin-in-docker-execstart-in-docker-php-api/64465>\
**Category:** General\
**Created:** [December 5, 2018, 11:15am UTC](https://forums.docker.com/t/how-to-stdin-in-docker-execstart-in-docker-php-api/64465 "2018-12-05T11:15:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohammadrezasoft74](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@mohammadrezasoft74](https://forums.docker.com/u/mohammadrezasoft74)\
**Post date:** [December 5, 2018, 11:15am UTC](https://forums.docker.com/t/how-to-stdin-in-docker-execstart-in-docker-php-api/64465/1 "2018-12-05T11:15:42Z")

</div>

```auto
 $remoteSocket ='192.168.85.34:2375';
 $ssl = false;
// Connect to Docker
$client = DockerClientFactory::create([
'remote_socket' => $remoteSocket,
'ssl' => $ssl
]);
$docker = Docker::create($client);
$config = new ContainersCreatePostBody();
$config->setTty(true);
$config->setOpenStdin(true);
$config->setAttachStderr(false);
$config->setAttachStdout(false);
$config->setAttachStdin(false);
$config->setStdinOnce(false);
$config->setImage("test:2");
$creation = $docker->containerCreate($config);
$docker->containerStart($creation->getId());
$execConfig = new ContainersIdExecPostBody();
$execConfig->setTty(true);
$execConfig->setAttachStdout(true);
$execConfig->setAttachStderr(true);
$execConfig->setAttachStdin(true);
$execConfig->setCmd(['/bin/bash']);
$execid = $docker->containerExec($creation->getId(),$execConfig)->getId();
$execStartConfig = new ExecIdStartPostBody();
$execStartConfig->setDetach(false);
// Execute the command
$stream = $docker->execStart($execid,$execStartConfig);
//var_dump($stream);die();
// To see the output stream of the 'exec' command
$stdoutText = "";
$stderrText = "";
$stream->onStdout(function ($stdout) use (&$stdoutText) {
echo $stdout;
});
$stream->onStderr(function ($stderr) use (&$stderrText) {
print_r("err: ".$stderr."\n");
});
$stream->wait();

```

pleaaaaaaaaaaase HELP MEEEEE .  
its my code . in this example i want to interact with bash . i get output from container but i can’t sent anything to container. i think i should do something with Tty !!!  
thanks in advance.

---

<div class="post-metadata">

**Author:** ![mohammadrezasoft74](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@mohammadrezasoft74](https://forums.docker.com/u/mohammadrezasoft74)\
**Post date:** [December 6, 2018, 3:43pm UTC](https://forums.docker.com/t/how-to-stdin-in-docker-execstart-in-docker-php-api/64465/2 "2018-12-06T15:43:15Z")

</div>

anybody does not help me?
