agkozak/zsh-z

zsh-z fails to work if `.z` is mapped to docker host file

Opened this issue · 2 comments

Hi thanks for the library! I want to use it in docker containers (indeed https://github.com/jupyter/docker-stacks). It works pretty well, until I want to keep the history between container re-creations. To do so, I add a volume mount from my host to the container, e.g. the following docker compose file:

    volumes:
      - /home/tom/my_container_z:/home/jovyan/.z

However, zsh-z fails to work implicitly now. The .z is also always empty.

I guess it may because file locking mechanism etc. Is there any way to workaround it?

I'll probably want to try out doing exactly what you're doing to see if I can detect what's going wrong. If you give me a couple of days, I should have time.

Thank you very much and take your time!

More detailed reproduction steps:

Here is my Dockerfile (omitting unrelated parts):

# Or use jupyter's docker-stacks directly; This one just adds more python packages and gpu support etc
FROM cschranz/gpu-jupyter:v1.6_cuda-12.0_ubuntu-22.04

# ... other commands omitted ...

USER root
RUN set -eux ; \
    chsh -s $(which zsh) ; \
    sh -c "$(curl -fsSL https://install.ohmyz.sh/)"
USER ${NB_UID}

RUN set -eux ; sed -i 's/plugins=(git)/plugins=(git z)/g' /home/jovyan/.zshrc

docker-compose.yaml:

version: "3"

services:
  jupyter:
    build: ./jupyter
    ports:
      - '8888:8888'
    command: 'start-notebook.py --ServerApp.root_dir=/host_home'
    environment:
      SHELL: /bin/zsh
    volumes:
      - /home/tom/Main/Others/primary_docker/.zsh_history:/home/jovyan/.zsh_history
      - /home/tom/Main/Others/primary_docker/.z:/home/jovyan/.z
    # ... unrelated things