Howto remove/fix “WARNING: terminal is not fully functional” in docker

undefined

How many times did you try to use  top command in docker container and it didn’t work? or How many times did you try to use vim or less command and it didn’t work properly?

For me many times. Both me and you saw the following error/warning messages before and try to get rid of them.

This mini post will remove the following errors and all test-based programs inside a docker container will work just perfect.

For more details on docker TERM variable, check our complete article :

How to Set/Fix the TERM Environment Variable in Docker

But for this mini post, here’s the error messages:

  • For clear and top commands:

TERM environment variable not set.

  • For less command:

WARNING: terminal is not fully functional

  • For nano command:

Error opening terminal: unknown.

To solve those errors, we need to set the TERM variable inside our container. We have two options:

  • Option 1: recreate the container from it’s image with -t/--tty option.

Here’s “if possible” delete the container and re-create it again with adding -t/–tty option to the docker run command, as follow:

$ docker run -it --name centos_container centos /bin/bash

Now, all programs will work fine permanently.

  • Option 2: Set the TERM variable inside your container.

Here’s we’ll add a TERM environment variable inside our container, this variable will solve this errors for current session and you need to add it again every time you connect to your container, Here’s the steps:

$ docker exec -it <a-docker-container> /bin/bash
export TERM=xterm

Now, your container will work just as perfect for the current session.

If You Appreciate What We Do Here On Mimastech, You Should Consider:

  1. Stay Connected to: Facebook | Twitter | Google+
  2. Support us via PayPal Donation
  3. Subscribe to our email newsletters.
  4. Tell other sysadmins / friends about Us - Share and Like our posts and services

We are thankful for your never ending support.

One Comment to Howto remove/fix “WARNING: terminal is not fully functional” in docker

  1. Pawel Graczyk says:

    Should be:

    docker exec -it bash -c “export TERM=xterm; exec bash”

    or

    docker exec -it env TERM=xterm bash -l

Leave a Reply

Your email address will not be published. Required fields are marked *