Tmux as Entrypoint deactivates unicode characters

Viewed 37

I'm building a Docker image including a ready to use terminal with all my usual tools.

I'm running a 2020 Macbook Air M1 running Monterey 12.5.1.

I'd like to start the container directly in a tmux session, but the characters display behavior is inconsistent.

  • When ENTRYPOINT is ["zsh"] and I execute tmux in the interactive container, the characters are as expected : Conform characters and when executing tmux : conform tmux
  • but when changing the ENTRYPOINT to ["zsh", "-c", "tmux"] : not conform tmux

Here is my Dockerfile :

FROM ubuntu:22.04

ARG USER=ben
ENV GROUP=${USER}
ENV HOME=/home/${USER}
ENV TMUX_SESSION_NAME=devops

RUN groupadd ${GROUP}

RUN useradd -m -g ${GROUP} ${USER}

RUN apt-get update -y && apt-get upgrade -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get install -y \
    ca-certificates \
    curl \
    git \
    wget \
    docker \
    vim \
    fzf \
    zsh \
    fd-find \
    zsh-syntax-highlighting \
    tmux \
    locales \
    locales-all

RUN usermod -s /bin/zsh ${USER}

# Configuring locales
RUN ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime \
    && dpkg-reconfigure --frontend noninteractive tzdata

USER ${USER}
WORKDIR /home/${USER}

# Oh-My-Zsh configuration
RUN wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O - | zsh || true

# ZSH plugins
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

COPY --chown=${USER}:${GROUP} zshrc ${HOME}/.zshrc
COPY --chown=${USER}:${GROUP} tmux.conf ${HOME}/.tmux.conf
COPY --chown=${USER}:${GROUP} p10k.zsh ${HOME}/.p10k.zsh

# ENTRYPOINT ["zsh", "-c", "tmux"]
ENTRYPOINT ["zsh"]
1 Answers

I couldn't find the reason for this behavior, but I investigated starting tmux directly from zsh and not in the ENTRYPOINT, and the solution that solved my issue was to set the environment variables ZSH_TMUX_AUTOSTART=true. Thank you all for your help !

Related