Add Zsh and OhMyZsh to your setup docker instances

Add Zsh and OhMyZsh to  your setup docker instances

When I first start an application that I know will use docker, I like to avoid having to install ANY dependency that project may have. Docker is great for this, because I can create a linked setup / staging environment.

However, I'm also not really willing to give up some of the things i've done to make my terminal experience better. For this, I use zsh...

# Staging Container
FROM node:8.12.0

# Set working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app

# Add app
COPY . /usr/src/app

# Install Zsh to make life easier
RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "zsh"]
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true

# Add any global dependencies you need
# RUN npm install -g @angular/cli

CMD ["zsh"]

Once you have this Dockerfile in your application directory, you will need to build the image.

$ docker build . -t staging

The -t param allows you to alias your staging image. In this case, we have given it the alias "staging".

And finally, to get into the staging image and start your zsh journey...

$ docker run --rm -it staging -v "$PWD":/usr/src/app