My personal development machine inside Docker.
- Tmux for terminal multiplexing
- Zsh
- Oh-My-Zsh installed for Zsh management
- ASDF VM for managing multiple runtimes
- NeoVim with my custom configuration
- Fuck for easily correcting commands
- Colors and themes:
- Languages:
- Python 2 and 3 available via
python2
andpython3
respectively - Erlang/OTP 21.2.5 installed via ASDF
- Elixir 1.8.0 installed via ASDF
- Python 2 and 3 available via
- Other tools:
- Elixir-LS language server for use with NeoVim.
The image is automatically built to Docker Hub here from each commit on the master branch. Thus, the only tag on the image is latest
. So, when you pull the image, you will pull the image which was built from the latest commit to master.
Since Devbox is built on Docker, you might want to read the Docker documentation in order to learn all about using it, specifically the getting started section about containers. However, this document should provide enough direction to use the container for basic use.
The Docker image is available from the Docker Hub. A new image is pushed to the jswny/devbox:latest
tag each time a new commit is pushed to the master
branch of the GitHub repository.
The image is based on Ubuntu 18.04
.
To obtain the image actual image so that you can run it, you can either clone this repository and build the image from source (which will take about 10-15 minutes as the image is quite large), or, you can pull it and run it from Docker Hub. See below for instructions for each option.
To build the image from source, first clone this repository, then build it using Docker.
$ git clone https://github.com/jswny/devbox
$ cd devbox
$ docker build -t jswny/devbox .
If you want to pull the prebuilt image from Docker Hub instead of building it yourself, all you have to do is pull it using Docker.
$ docker pull jswny/devbox
If you use docker run
(as shown below), Docker will pull the image automatically. However, you may want to pull it manually if you don't want to run it right away or if you want to force the image to update from Docker Hub.
Once you have the image either built from source or pulled from Docker Hub, you can run it using Docker
$ docker run -it -h devbox --name devbox jswny/devbox
This command sets the internal hostname of the container as devbox
using the -h
flag.
You can also run the container so that it automatically removes itself after it stops running with the --rm
flag. Keep in mind that this may cause you to lose any data from inside the container.
$ docker run -it --rm -h devbox --name devbox jswny/devbox
You may also want to run the container without a name, or without a hostname, so that you can run many container instances of this image. To do so, remove those commands like so:
$ docker run -it jswny/devbox
You can use a Docker volume to mount local files into the internal filesystem of the container so that you can access them inside the container. Any changes you make to the files in the volume inside the container will be reflected outside the container, and vice versa.
To mount a volume when running the container, add the -v /local/path/:/internal/container/path
flag when running the container:
$ docker run -it --rm -v /local/path/:/internal/container/path -h devbox --name devbox jswny/devbox
If the container is still running and you need to stop it, such as if it was shown when you run docker container ls
, you can do the following:
$ docker stop devbox
Warning: this will completely stop the container and anything running inside of it, so be careful.
Once a container is stopped, it will not be shown when you run docker container ls
, but it will be shown when you run docker container ls -a
, which will show that the container has exited, which looks something like this:
$ docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2173dbd2146 alpine:latest "/bin/sh" 40 seconds ago Exited (0) 39 seconds ago brave_pike
To remove a stopped container, you can do the following:
$ docker rm devbox
If you want to remove the actual image from which you run Devbox containers, you can remove it like so:
$ docker rmi jswny/devbox
If you want to remove all of the cached layers to ensure everything is completely clean, you can use the following:
docker system prune
You may want to do this if you are compiling the image from the Dockerfile yourself to ensure that everything is built cleanly.
Devbox is optimized for the Solarized Dark colorscheme.
In addition, the shell prompt that is configured requires a Powerline patched font to display certain things. You can find and install Powerline patched fonts through this Powerline repository.
You may need to tell your terminal to do the following (play around with these if the text doesn't look right):
- Draw bold text in bold font
- Draw bold text in bright colors
I recommend the following (this is my setup):
- macOS
- iTerm 2
- Bold text drawn in bold font
- Solarized dark terminal colors
- Meslo LG M DZ Powerline patched font
Configuration files live in the dotfiles
directory in this repository. Devbox attempts to follow the XDG Specification wherever possible.
Currently, the following configuration files are provided:
.config/zsh/.zshrc
for Zsh.config/nvim/init.vim
for NeoVim (similar to.vimrc
for Vim)zshenv
to configure Zsh to use XDG and set environment variables accordingly. These need to be set prior to sourcing.zshrc
because the.zshrc
file is located inside the XDG config directory..config/tmux/tmux.conf
for Tmux
- When running Devbox inside Tmux from the host, Zsh does not always render the prompt spacing correctly, so the Agnoster prompt might not have a space before typing like it should have.
- Use XDG for ASDF (should be
$XDG_DATA_HOME/asdf
) - Fix duplicate
.zcompdump*
files (one in$ZDOTDIR
and one in$XDG_CACHE_HOME/zsh
) - Find some way to use Tmux with the XDG config file in
$XDG_CONFIG_HOME/tmux/tmux.conf
- Don't show warnings/errors on status line when there are none to show
- Set
$ZSH
for Oh-My-Zsh installer withoutexport
- Readme info on how to restart a stopped container
- Readme info on how to
exec
into background container - Readme info on goals
- Readme info on advantages/disadvantages
- Add Tmux CPU plugin
- Support Phoenix Development (probably requires configuring ports with Docker)
- Look into coc.nvim to replace LanguageClient-NeoVim (potentially)
- Fix snippet support in NeoVim with Elixir (etc.)
- Figure out how to use SSH keys
- Use Lightline instead of Airline for NeoVim