How to temporarily fix the message “TERM environment variable not set” while working with a Docker container

Sometimes at least these days with the current version of Docker you may stumble upon the message “TERM environment variable not set”.

This happened to me while being inside a container with “docker exec -ti”.

clear, top, etc. were not working and complaining about the not set variable.

If you execute this while inside the container:

export TERM=xterm


export TERM=${TERM:-dumb}

the warnings will stop and you can have the real thing.