Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Setting up Windows Services for Linux and Docker for Windows for Ruby on Rails development

Setting up Windows Services for Linux (WSL) and Docker for Windows for Ruby on Rails development


On your Windows 10 development machine you should have installed

  1. Windows Services for Linux and a Debian-based app like Ubuntu.
  2. putty
  3. Docker for Windows (and I use Kitematic because I'm a Docker n00b)

putty should be configured to supply your private key to authenticate with a server.

SSH server

sudo ssh-keygen -A # or it moans that the server keys aren't there
sudo service ssh start
mkdir ~/.ssh && chmod 700 ~/.ssh
curl -o ~/.ssh/authorized_keys && chmod 600 ~/.ssh/*

You should now be able to connect to localhost using putty. From this point on it's easier to use putty than the WSL console (in my opinion).


curl -o ~/.bashrc_extras
echo -e "\nif [ -f $HOME/.bashrc_extras ]; then\n  source $HOME/.bashrc_extras\nfi" >> ~/.bashrc
source ~/.bashrc


curl -o ~/.zshrc_extras
echo -e "\nif [ -f $HOME/.zshrc_extras ]; then\n  source $HOME/.zshrc_extras\nfi" >> ~/.zshrc
source ~/.zshrc


Using instructions from

gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL | bash -s stable
source /home/build/.rvm/scripts/rvm
type rvm | head -n 1
rvm autolibs enable
rvm requirements
echo rvm_autoupdate_flag=2 >> ~/.rvmrc
rvm rvmrc warning ignore allGemfile


I keep a copy of my private keys in Keybase so we'll install this first.

Instructions copied from Keybase site

curl -O
# if you see an error about missing `libappindicator1`
# from the next command, you can ignore it, as the
# subsequent command corrects it
sudo dpkg -i keybase_amd64.deb
sudo apt-get install -f

Then do a keybase login - consult the documentation to find out how to register an account and provision a device if you need to. What we're looking for is to be able to do this:

keybase fs ls -a -l /keybase/public/dominicsayers/keys


git config --global ""
git config --global "Dominic Sayers"
git config --global pull.rebase true
git config --global rebase.autosquash true
keybase fs read /keybase/private/dominicsayers/keys/id_rsa > ~/.ssh/id_rsa && chmod 600 ~/.ssh/*
ssh -vT

App prerequisites

The app I'll be working on has some prerequisites. Yours may too. Lets install them now.

# To successfully install the `pg` gem we need the Postgres client
sudo apt-get install libpq-dev postgresql-client
# We need a Javascript runtime
curl -sL | sudo -E bash -
sudo apt-get install -y nodejs

For my tests to run successfully I now need to download a postgresql Docker image, configure it with a port and password (or no password) and set it running.

Development environment

mkdir -p Development/dominicsayers
git clone
cd rails-template
git checkout initial-scaffolding
cd . # Should prompt to install a ruby
cd . # again. Now it should create a gemset
gem update --system
gem install bundler
bin/rails db:setup RAILS_ENV=test # Probably need to make a `.env.test.local` or `config/database.yml` at this point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.