Ejecución de nano en contenedor docker
Abro un shell interactivo en un contenedor docker así
sudo docker exec -t -i {container_name} bash
Hasta ahora todo bien, pero intentar ejecutar nano
resulta en:
Error al abrir el terminal: desconocido.
6 answers
Creo que esto puede estar relacionado con Docker Issue #9299.
Hay algunas soluciones comentadas en ese número:
- Ejecute el contenedor asignando un pseudo-TTY (opción
-t
). - Export variable de entorno TERM TERM=xterm en el proceso del contenedor ejecutado en exec (i. e.:
export TERM=xterm
)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-01-07 19:05:10
Ejecutar comando: export TERM=xterm
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-22 10:32:06
Puede agregar
ENV TERM xterm
A su Dockerfile si va a utilizar el editor regularmente. Tenemos esa configuración en nuestro contenedor base, ya que estamos constantemente depurando cosas con vi / emacs.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-01-07 20:18:30
Como $TERM
ya estaba establecido en xterm
pero todavía no funciona para mí, aquí hay una forma que funcionó: docker exec -it [CONTAINER_ID] /bin/bash -c "export TERM=xterm; exec bash"
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-23 15:18:51
docker exec -it id_container bash
apt-get update
apt-get install nano
export TERM=xterm
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-18 19:53:00
Hice una solución, en mi .bashrc he añadido:
alias nano='export TERM=xterm && nano'
En este caso el error ya no aparece
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-15 16:38:04