antigen icon indicating copy to clipboard operation
antigen copied to clipboard

Theme does not get loaded in a docker container

Open romkatv opened this issue 6 years ago • 6 comments

I cannot figure out how to make antigen theme work in a docker container. Here's what I've tried:

docker run -e LANG=C.UTF-8 -e TERM -it --rm debian:buster bash -uexc '
  apt update && apt install -y zsh git curl gawk sudo
  useradd -ms =zsh test
  sudo -u test curl -fsSLo ~test/antigen.zsh https://git.io/antigen
  sudo -u test tee ~test/.zshrc >/dev/null <<<"
    POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
    source ~/antigen.zsh
    antigen theme romkatv/powerlevel10k
    antigen apply"
  exec su - test'

Eventually this command prints Installing romkatv/powerlevel10k!... and then apparently nothing happens. At this point zsh is responsive but its PROMPT is empty.

echo -E - ${(q)PROMPT}
''
pwd
/home/test

(Here echo and pwd are commands I've typed.)

~/.antigen/init.zsh doesn't have a command to source the theme.

grep powerlevel10k ~/.antigen/init.zsh
fpath+=(/home/test/.antigen/bundles/romkatv/powerlevel10k) path+=(/home/test/.antigen/bundles/romkatv/powerlevel10k)
typeset -gaU _ANTIGEN_BUNDLE_RECORD; _ANTIGEN_BUNDLE_RECORD=('https://github.com/romkatv/powerlevel10k.git / theme true')
typeset -ga _ZCACHE_BUNDLE_SOURCE; _ZCACHE_BUNDLE_SOURCE=('/home/test/.antigen/bundles/romkatv/powerlevel10k//')

I've tried it with a different theme by replacing antigen theme romkatv/powerlevel10k with antigen theme powerlevel9k/powerlevel9k in the docker command. The result is the same. Loading themes by manually sourcing them works fine.

A seemingly identical command works on my local machine running the same distro.

(
  emulate -L zsh
  setopt err_return no_unset
  sudo useradd -ms =zsh test
  {
    sudo -u test curl -fsSLo ~test/antigen.zsh https://git.io/antigen
    sudo -u test tee ~test/.zshrc >/dev/null <<<"
      POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
      source ~/antigen.zsh
      antigen theme romkatv/powerlevel10k
      antigen apply"
    sudo su - test
 } always {
   sudo userdel -r test 2>/dev/null
 }
)

Here after Installing romkatv/powerlevel10k!... the expected prompt appears. ~/.antigen/init.zsh does have a command to source the theme.

grep powerlevel10k ~/.antigen/init.zsh
fpath+=(/home/test/.antigen/bundles/romkatv/powerlevel10k) path+=(/home/test/.antigen/bundles/romkatv/powerlevel10k)
source '/home/test/.antigen/bundles/romkatv/powerlevel10k/powerlevel10k.zsh-theme.antigen-compat';
typeset -gaU _ANTIGEN_BUNDLE_RECORD; _ANTIGEN_BUNDLE_RECORD=('https://github.com/romkatv/powerlevel10k.git / theme true')
typeset -ga _ZCACHE_BUNDLE_SOURCE; _ZCACHE_BUNDLE_SOURCE=('/home/test/.antigen/bundles/romkatv/powerlevel10k//' '/home/test/.antigen/bundles/romkatv/powerlevel10k///powerlevel10k.zsh-theme')

The only difference I can think of between these two environments is that on my local machine I have extra packages installed. Is it possible that in my docker container some external command is missing that antigen needs? What could it be?

I'm attaching ~/.antigen/debug.log from docker.

debug.log

romkatv avatar Oct 06 '19 10:10 romkatv

docker run -e LANG=C.UTF-8 -e TERM -it --rm debian:buster

I made a Dockerfile suitable for producing a reduced test case with buster with a 1 arg change. It's part of a small command line tool which uses GNU Stow to share dotfiles cross-platform. Hope it might help. 🙏🏻

ghost avatar Oct 24 '19 14:10 ghost

Same problem here! This seem to be only related to buster because the same docker configuration is fine with jessie, bionic & xenial. I also noticed that the aliases are also not loaded.

m-dhooge avatar Mar 06 '20 13:03 m-dhooge

Well, both antigen reset and touch .zshrcsolve the problem for the next shell launched. This will be enough as a workaround…

m-dhooge avatar Mar 06 '20 15:03 m-dhooge

@romkatv - were you able to figure out a solution for this? running into the same issue.

It seems to work sometimes (I think it may be when run the first time) but usually not thereafter. Here is my repro Docker file:

docker run -e TERM -e COLORTERM -e LC_ALL=C.UTF-8 -it --rm alpine sh -uec '
  apk add git zsh nano vim curl
  mkdir ~/dotfiles
  echo "source ~/dotfiles/zshrc" >> ~/.zshrc

  curl -L git.io/antigen > ~/dotfiles/antigen.zsh
  curl -L https://gist.githubusercontent.com/pringshia/7b5c03790474e3df0d14885bb0e06ee1/raw > ~/dotfiles/.p10k.zsh

  echo "source ~/dotfiles/antigen.zsh" >>~/dotfiles/zshrc
  echo "antigen reset" >>~/dotfiles/zshrc
  echo "antigen theme romkatv/powerlevel10k" >>~/dotfiles/zshrc
  echo "source ~/dotfiles/.p10k.zsh" >>~/dotfiles/zshrc
  echo "antigen apply" >>~/dotfiles/zshrc
  exec zsh'

pringshia avatar Apr 02 '22 21:04 pringshia

@romkatv - were you able to figure out a solution for this?

No. It's a bug in antigen.

romkatv avatar Apr 02 '22 22:04 romkatv

I ended up going with antibody instead, that seems to work fine.

pringshia avatar Apr 02 '22 22:04 pringshia