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