Runar Ovesen Hjerpbakk

Software Philosopher

The input device is not a TTY - error on a build machine

Half a year ago I wrote an article on Docker, bash and invisible characters, an instance where Docker, due to my own lack of understanding, appended \r to its output.

Today I got the same error, manifesting in a different way.

Both this site and Pappaperm.com is built using Jekyll, and since Ruby can be a pain to setup locally, Docker containers are used to ensure a consistent build environment. I also run a bunch of checks on each commit to the websites, one of them is markdownlint, a Node.js style-checker and linting tool for Markdown files. This checks for consistent formatting and style in the Markdown source files. This command too is also running through a docker container:

docker run --rm -v $PWD:/usr/src/app/files -it andmos/markdownlint **/*.md -i ./_drafts -i ./_my_tags

The command mounts the current working directory, checks all files ending with .md while skipping files in the _drafts and _my_tags folders, runs the container in interactive mode and removes it when the run completes.

The build for pappaperm is run using GitHub Actions and on its first run I got this error:

The most observant of you, dear readers, have already spotted my mistake.

the input device is not a TTY

Why would I ever need run a container in interactive mode on a headless build machine? Never, and removing -it from the above command solved the problem.

The morale of this little tale is that I need to understand the options used, and not just blindly copy paste from myself, and indeed, remember what I’ve learned before! To quote my earlier post:

In the docker-command above I’ve used -it:

-i is short for –interactive. Keep STDIN open even if unattached.

-t is short for –tty. Allocates a pseudo-terminal that connects your terminal with the container’s STDIN and STDOUT.

So, don’t use -it if you don’t mean it.