I found that more often than not, I wanted to put my development environment inside of Docker, not just my running code. My editor has plugins that help me browse documentation and check my syntax, but none of that works without installing additional stuff, and Docker has made me quite averse to installing anything on my host system.
So, I started stringing together Docker commands to do what I wanted, and I grew frustrated at all the copy/paste, and thought: There’s gotta be a better way.
If you’re interested in how it does this, see the nitty gritty details.
Go to the releases page.
Make sure it’s executable and in your path.
--type go - select the default version (1.6) of the pre-configured Go image.
--type python --version 2.7 - select the 2.7 version of the pre-configure Python image.
Currently, go, clojure, and python are baked in. More will come.
create - Creates an environment.
connect - Connect to an environment.
destroy - Destroys an environment and its home directory.
rebuild - Rebuilds an environment, preserving the environment’s home directory.
run - Creates an environment and immediately connects to it.
start - Starts an environment.
stop - Stops an environment.
inspect - Shows details about an environment as a JSON dump.
list - Lists existing environments.
images - Lists base images or user specific images.
Ensure that the skegio/python:3.5 image is pulled.
Ensure that the skeg ssh key is present. If not, one is generated.
Build an image based on skegio/python:3.5 which includes a user matching the host user.
Start a container running sshd that mounts ~/skegs/myapp in as the user’s home directory and the current directory in as a subdirectory.
Do I have to use one of the pre-configured images?
Not at all. You can create your own image and use it by specifying the -i flag to skeg create or skeg run. For now, your image needs to be based on skegio/base (like nate/aws), but that will change as skeg gets more sophisticated.
Why does skeg run the container as a long running process and connect over SSH rather than only for the lifetime of a process?
Development environments live longer than a single process, and they often involve many processes. Juggling these processes within an SSH session is a well understood problem with great solutions (like tmux), so for familiarity skeg takes the same approach.
Also, there are many times where additional software needs to be installed and daemons run to try something out. A long running container is perfect for these situations. Skeg offers a rebuild command, which will destroy and create the docker container with the same environment home directory, making it easy to reset back to a known state.