14.04 inside docker "TERM environment variable not set"

13,461

Solution 1

Short of having to edit a config after launching the container, instead you can just define the missing environment variable when you run the debian based container

-e TERM=xterm 

as in this example

export DUMMY_SERVER_NAME=itswednesday

docker run \
  -d \
  --name $DUMMY_SERVER_NAME \
  -e TERM=xterm \
  --expose=80 \
  debian /bin/bash -c "while [[ true ]]; do sleep 1; done"

Solution 2

thanks to the comments from Gunnar Hjalmarsson this is what seems to solve the issue

docker start [container]
docker exec -it [container] bash
vim /etc/bash.bashrc

adding export TERM=xterm to the top of the file, stopping/restarting my container ...

e voila! ... the terminal seems to behave 'normal' (which I tested by using the clear command which didn't work before and now does)

thanks again and sorry for introducing misleading terms (terminal/console) in my original post.

Share:
13,461

Related videos on Youtube

vrms
Author by

vrms

Updated on September 18, 2022

Comments

  • vrms
    vrms over 1 year

    I am running an ubuntu 14.04 inside a docker container. My image is build from the official ubuntu:14.04 image) The Docker file is almost identical with this https://github.com/pfy/erpnext/blob/master/Dockerfile (just changed FROM debian:wheezy >>> FROM ubuntu:14.04).

    ERPNext is being installed using this script https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh).

    The build and run instruction to be found here https://raw.githubusercontent.com/pfy/erpnext/master/README.md

    Somehow it is working but the terminal/console seems not to be fully functional.

    i.e. I get a "TERM environment variable not set" when I try to clearthe screen. I found some other posts with the same or similar error message but the context is always different, so I can't get anything from the solutions offered.

    I guess the docker ubuntu images might be used pretty frequent, so maybe someone has encountered and solved this issue.

    • Gunnar Hjalmarsson
      Gunnar Hjalmarsson about 8 years
      TERM should be set by the terminal emulator. Which terminal emulator are you using?
    • vrms
      vrms about 8 years
      honestly. no idea which terminal emulator I am using. I didn't install any and I don't think the scripts that ran to install ERPNext install any. So it should be what is 'shipped' with the ubuntu:14.04 docker image.
    • vrms
      vrms about 8 years
      I found out that this problem doesn't exist when running a container from the fresh ubuntu:14.04 image. So it seems it occurs somehow through the ERPNext installation. I can't identify anything responsible for such in the scripts that are being run. I don't understand too much of them though I should add.
    • vrms
      vrms about 8 years
      just a thought: there is no Desktop environment, so is there a terminal emulator involved at all ?
    • Gunnar Hjalmarsson
      Gunnar Hjalmarsson about 8 years
      It was you who mentioned "terminal/concole". The default terminal eliminator in Ubuntu is gnome-terminal and the default user shell is bash. Without really understanding the implications of the docker, a workaround might possibly be to add export TERM=xterm at the top of .bashrc.
  • Gunnar Hjalmarsson
    Gunnar Hjalmarsson about 8 years
    Glad to hear that you could fix it that way.