mreferre / zsh-in-docker

Install Zsh, Oh-My-Zsh and plugins inside a Docker container with one line!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Oh My Zsh Installer for Docker

This is a script to automate Oh My Zsh installation in development containers. Works with any images based on Alpine, Ubuntu, Debian or CentOS.

The goal is to simplify installing zsh in a Docker image for use with VSCode's Remote Conteiners extension

Usage

One line installation: add the following line in your Dockerfile:

# Default powerline10k theme, no plugins installed
RUN sh -c "$(wget -O- https://raw.githubusercontent.com/deluan/zsh-in-docker/master/zsh-in-docker.sh)"

Optional arguments:

  • -t <theme> - Selects the theme to be used. Options are available here. By default the script installs and uses Powerlevel10k, one the "fastest and most awesome" themes for zsh. This is the recomended theme, as it is extremely fast for git info updates
  • -p <plugin> - Specifies a plugin to be configured in the generated .zshrc. List of bundled Oh My Zsh plugins are available here. If <plugin> is a url, the script will try to install the plugin using git clone.

Examples:

# Uses "robbyrussell" theme (original Oh My Zsh theme), with no plugins
RUN sh -c "$(wget -O- https://raw.githubusercontent.com/deluan/zsh-in-docker/master/zsh-in-docker.sh)" -- \
    -t robbyrussell
# Uses "git" and "ssh-agent" bundled plugins
RUN sh -c "$(wget -O- https://raw.githubusercontent.com/deluan/zsh-in-docker/master/zsh-in-docker.sh)" -- \
    -p git -p ssh-agent
# Uses "agnoster" theme, uses some bundled plugins and install some more from github
RUN sh -c "$(wget -O- https://raw.githubusercontent.com/deluan/zsh-in-docker/master/zsh-in-docker.sh)" -- \
    -t agnoster \
    -p git \
    -p ssh-agent \
    -p https://github.com/zsh-users/zsh-autosuggestions \
    -p https://github.com/zsh-users/zsh-completions

Notes

  • The examples above use wget, but if you prefer curl, just replace wget -O- with curl
  • This scripts requires git and curl to work properly. If your Dockerfile uses root as the main user, it should be fine, as the script will install them automatically. If you are using a non-root user, make sure to install the sudo package OR to install git and curl packages before calling this script
  • By default this script install the powerlevel10k theme, as it is one of the fastest and most customizable themes available for zsh. If you want the default Oh My Zsh theme, uses the option -t robbyrussell

About

Install Zsh, Oh-My-Zsh and plugins inside a Docker container with one line!

License:MIT License


Languages

Language:Shell 91.5%Language:Dockerfile 8.5%