title: How to run docker container with -i -t options using TeamCity?
body: <p>I'm trying to run docker container as part of a build on linux TeamCity build agent. However, if I run docker container with <code>-i -t</code> options, there is no output in the Build Log from executed command.</p>
  
  <p>Command Line build step:</p>
  
  <pre><code>sudo docker run -i -t --name="echo_test" ubuntu echo "test"
  </code></pre>
  
  <p>Build Log missing output from echo command:</p>
  
  <pre><code>Step 1/2: Command Line (1s)
     [Step 1/2] Starting: /home/ec2-user/BuildAgent/temp/agentTmp/custom_script6340936320796175009
     [Step 1/2] in directory: /home/ec2-user/BuildAgent/work/831248796cfa0a04
     [Step 1/2] Process exited with code 0
  </code></pre>
  
  <p>Docker container logs do have the output from echo command:</p>
  
  <pre><code>[ec2-user@ip-10-28-218-103 ~]$ docker logs echo_test
  test
  </code></pre>
  
  <p>Could someone explain why this is happening or provide some way to diagnose the issue?</p>
  
  <p>If I change <code>run docker</code> options to either: just <code>-i</code>, just <code>-t</code>, or remove them both it works.</p>
  
  <p>It's worth mentioning that at first I was getting <code>sudo: sorry, you must have a tty to run sudo</code> error when trying to execute sudo commands in Command Line build step in TeamCity. I commented out <code>Default requiretty</code> in <code>/etc/sudoers</code> to solve this.</p>
  
  <hr>
  
  <p>I got echo to output text to Build Log by adding <code>-a stdout -a stderr</code> options.</p>
  
  <p>Command Line build step:</p>
  
  <pre><code>sudo docker run -i -t -a stdout -a stderr --name="echo_test" ubuntu echo "test"
  </code></pre>
  
  <p>So the question is now why they were not required when executing command on local machine.</p>