Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TERM environment variable not set." when executing "mysql" in container #3

txthai opened this issue Nov 5, 2014 · 27 comments


Copy link

@txthai txthai commented Nov 5, 2014

docker exec -it mariadb bash
produces the following error message: TERM environment variable not set.

Unsure why since echo $TERM returns dumb and issuing export TERM=dumb resolves issue.

If the environment variable is explicitly issued in the dockerfile, the error message never appears, i.e. adding ENV TERM dumb

Copy link

@darkmou5e darkmou5e commented Dec 12, 2014

I have same problem. txthai, thank you for solution!

Copy link

@wmariuss wmariuss commented Dec 16, 2014

Good to know. Thanks.

Copy link

@k2xl k2xl commented Jan 15, 2015

LOL I had this issue too, thanks for the tip.

Copy link

@oskarmust oskarmust commented Jun 1, 2015

thanks, had the same issue with postgresql container and top

Copy link

@mahnunchik mahnunchik commented Jul 31, 2015


Copy link

@vladmiller vladmiller commented Aug 5, 2015

_CoreOS stable (723.3.0)_ unfortunately your solution doesn't work 😫

_UPD:_ Ok, I was actually able to ssh to a container

docker run -it mariadb_container bash

and then inside set TERM variable

Copy link

@geraldvillorente geraldvillorente commented Aug 6, 2015

export TERM=dumb works great but the issue returns once you reboot or restart the VM. To make is permanent I guess you need to put export TERM=dumb in ~/.bashrc or similar files.

Copy link

@wmariuss wmariuss commented Aug 6, 2015

Or .profile

Copy link

@thanh-nguyen-van thanh-nguyen-van commented Sep 1, 2015

thank you ! Nice to know that.

Copy link

@hisapy hisapy commented Sep 3, 2015

Hey guys, try the following to get a nicer top

export TERM=xterm

Copy link

@denysvitali denysvitali commented Sep 18, 2015

Better way:
echo "export TERM=dumb" >> ~/.bashrc

Then logout and login again 👍

Copy link

@anddan7 anddan7 commented Sep 18, 2015

Tried to run an image of ownCloud and ran into this exact problem. running export TERM=dumb does get rid of the error message however commands like clear and top doesn't seem to work.

Running export TERM=xterm did the trick though, anyone care to explain why?

Copy link

@zx1986 zx1986 commented Oct 12, 2015

@txthai WOW! it works perfect! thank you so much!
export TERM=dumb

Copy link

@federico-razzoli federico-razzoli commented Oct 22, 2015

I had the same problem after installing MariaDB 10.1 on official debian image, tag "jessie".

Copy link

@federico-razzoli federico-razzoli commented Oct 22, 2015

On a Debian container, when I run this:

apt-get install software-properties-common

I get a long output with these lines:

Setting up unattended-upgrades ( ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline

Hope this helps.

Copy link

@simonmorley simonmorley commented Dec 20, 2015


Copy link

@Dan-Dongcheol-Lee Dan-Dongcheol-Lee commented Jan 2, 2016

Thanks for the great tip!

Copy link

@fthamura fthamura commented Jan 3, 2016

any idea to fix this?

Copy link

@geraldvillorente geraldvillorente commented Jan 3, 2016


$ echo "export TERM=dumb" >> ~/.bashrc
$ source ~/.bashrc
Copy link

@lorenzop lorenzop commented Jan 7, 2016

This in the Dockerfile works. Setting it to xterm rather than dumb also fixed the clear command.

RUN echo -e "\nexport TERM=xterm" >> ~/.bashrc

Copy link

@kujiy kujiy commented Jan 7, 2016

+1 Thank you so much! @txthai

Why is this happened!

Copy link

@amirabiri amirabiri commented Mar 30, 2016

There is still a problem if you try to do something like:

docker exec -t db mysql < init.sql
Copy link

@zburgermeiszter zburgermeiszter commented Apr 7, 2016

This worked for me:
docker exec -i CONTAINER_ID /bin/bash -c "export TERM=xterm && mysql -proot -uroot database" < import.sql

Copy link

@holyorb2 holyorb2 commented Apr 14, 2016

# TERM=xterm mysql

Copy link

@geerlingguy geerlingguy commented Sep 25, 2016

This will be fixed in Docker 1.13, FYI: moby/moby#26461

Copy link

@justindurkin justindurkin commented Sep 29, 2016

@geerlingguy Thanks that's good news!

sebastian-luna-valero added a commit to CGATOxford/cgat that referenced this issue Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet