Install Zsh, Oh My Zsh and plugins inside a Docker container with one line!
https://github.com/deluan/zsh-in-docker.git
This is a script to automate Oh My Zsh installation in development containers. Works with any image based on Alpine, Ubuntu, Debian, Amazon Linux, RockyLinux 8,9 and Fedora.
The original goal was to simplify setting up zsh and Oh My Zsh in a Docker image for use with VSCode's Remote Containers
extension, but it can be used whenever you
need a simple way to install Oh My Zsh and its plugins in a Docker image
One line installation: add the following line in your Dockerfile:
# Default powerline10k theme, no plugins installed
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.1/zsh-in-docker.sh)"
-t <theme> - Selects the theme to be used. Options are availablezsh. This is my recommended theme. If <theme> is a url, the script will try to install the theme using git clone.
-p <plugin> - Specifies a plugin to be configured in the generated .zshrc. List of bundled<plugin> is a url, the script will try to install the plugin using git clone.
-a <line> - You can add extra lines at the end of the generated .zshrc (but before loading oh-my-zsh) by -a argument for each line you want to add. This is useful to customize plugins or themes.
For example, if you want to enable case sensitive completion:
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.1/zsh-in-docker.sh)" -- \
-a 'CASE_SENSITIVE="true"'
-x - Skip installation of dependencies: zsh, git, curl. If you are having issues with the script failing to# Uses "robbyrussell" theme (original Oh My Zsh theme), with no plugins
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.1/zsh-in-docker.sh)" -- \
-t robbyrussell
# Uses "git", "ssh-agent" and "history-substring-search" bundled plugins
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.1/zsh-in-docker.sh)" -- \
-p git -p ssh-agent -p 'history-substring-search' \
-a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \
-a 'bindkey "\$terminfo[kcud1]" history-substring-search-down'
# Uses "Spaceship" theme with some customization. Uses some bundled plugins and installs some more from github
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.1/zsh-in-docker.sh)" -- \
-t https://github.com/denysdovhan/spaceship-prompt \
-a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \
-a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \
-p git \
-p ssh-agent \
-p https://github.com/zsh-users/zsh-autosuggestions \
-p https://github.com/zsh-users/zsh-completions
wget, but if you prefer curl, just replace wget -O- with curl -Lgit and curl to work properly. If your Dockerfile uses root as thesudo package OR to install git and curl packages
before calling this script. In case sudo access is an issue and you already have zsh, git
and curl, you can use the option -x to skip the installations.
powerlevel10k theme, as it is one of the fastest and most-t robbyrussell
If you like this script, feel free to thank me with a coffee (or a beer :wink:):