Docker error opening terminal unknown occurs when we try to enter the docker container and run basic bash commands.
Here at Bobcares, we have seen several causes for this error while troubleshooting Docker issues as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at the cause for this error and how to fix it.
Why does Docker error opening terminal unknown occur
Before getting into the solution part, let us now discuss why does this error occur.
Normally, this error occurs when we open the container using the below command and try to run programs like top, less, nano, or vim.
docker exec -ti <container-name> bash
The reason for this error is that the programs like the top, less or vim uses terminal information to fill the screen and recognize the keys that we hit. In case, if this information is incorrect, the screen will get messed up or keys will not be recognized.
For instance, the error appears as below.
How we fix Docker error opening terminal unknown
Recently, one of our customers approached us telling us that he was able to enter the container via sudo docker exec -t -i {container_name} bash
command. But after trying to run nano
, he received the below error.
Error opening terminal: unknown.
Now, let’s see how our Support Engineers resolve this error.
The easy and quick solution that we provide to our customers is that after entering the container we set the TERM environment variable to xterm.
To enter the container, we run the below command.
docker exec -ti <a-docker-container> bash
Then to set the TERM environment variable to xterm. For that, we ran the following command.
export TERM=xterm
This instantly fixed the error.
[Need any further assistance in fixing Docker errors? – We’re available 24*7]
Conclusion
In short, this Docker error occurs when we open the container and try to run basic bash commands. Today, we saw how our Support Engineers resolve this error to our customers.
0 Comments