Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: add example Dockerfile #2844

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docker: use bash instead of zsh
  • Loading branch information
Mr. Outis committed Nov 26, 2019
commit 0939985932d0c59058b8034cfcedc47677060e1f
26 changes: 2 additions & 24 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -16,40 +16,18 @@ WORKDIR /usr/src

# Install useful programs
RUN apt-get update -y && apt-get install -y \
zsh \
less \
git

# Set Zsh as the default shell
SHELL ["/usr/bin/zsh", "-c"]

# Install DVC with your specified files
RUN pip install "dvc[all]"

# Enable autocompletion scripts for DVC
RUN wget \
-O /usr/local/share/zsh/site-functions/_dvc \
https://raw.githubusercontent.com/iterative/dvc/master/scripts/completion/dvc.zsh
-O /etc/bash_completion.d/dvc \
https://raw.githubusercontent.com/iterative/dvc/master/scripts/completion/dvc.bash

# Add a user to run DVC
ARG USER_ID=1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose you are doing this so that files created by dvc are not owned by root, right? If so, now they are going to be owned by UID 1000, which is absolutely not guaranteed to match your current user on the host.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user must build the image with their UID, see the description of the issue:
#2844 (comment)

RUN useradd --create-home -u ${USER_ID} dvc
USER dvc

# Load and rice the completion menu with `zstyle`:
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fzutil-Module
RUN echo "autoload -U compinit && compinit" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:*:*:*:*' menu select" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:matches' group 'yes'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:options' description 'yes'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:options' auto-description '%d'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*:default' list-prompt '%S%M matches%s'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*' format ' %F{yellow}-- %d --%f'" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*' group-name ''" >> $HOME/.zshrc \
&& echo "zstyle ':completion:*' verbose yes" >> $HOME/.zshrc

CMD ["zsh"]