How to prepare Windows 10 for SW development – I

In this article I will try to describe all setting for using Windows 10 (
Professional or Enterprise 64-bit) for local SW development with using WSL (Windows Subsystem for Linux) and Docker Desktop for Windows.

List of installed SW on Windows 10
  • Enable WSL ( optional feature is enabled )
  • Download and install Ubuntu 18.04 LTS (from Microsoft store)
  • Download and install Docker Desktop for Windows
  • Install docker inside WSL (Ubuntu 18.04 LTS)
  • Install zsh inside WSL (Ubuntu 18.04 LTS)

Installation Docker Desktop for Windows

Download and install Docker desktop for Windows from here.
After installation make this settings.

Installation WSL (
Windows Subsystem for Linux )

Here you can find procedure how to install it. I have choose Ubuntu.
After start of Ubuntu you should set user name and password.

Installing Docker in WSL

While the Docker daemon cannot run directly on WSL, you can use the Docker CLI to connect to a remote Docker daemon running through Docker for Windows.

Start bash in cmd run folowing commands (here is the refernce)

# Update the apt package index.
$sudo apt-get update

# Install Docker's package dependencies.
$sudo apt-get install \
      apt-transport-https \
      ca-certificates \
      curl \
      gnupg-agent \
      software-properties-common

# Add Docker’s official GPG key:
$curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Update the apt package list (for the new apt repo).
$sudo apt-get update -y

# Allow your user to access the Docker CLI without needing root access.
$sudo usermod -aG docker $USER

# Allow your user to access the Docker CLI without needing root access.
$sudo usermod -aG docker $USER

# download the latest version of Docker Compose
$sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# Apply executable permissions to the binary:
$sudo chmod +x /usr/local/bin/docker-compose

now we need setup connection to docker deamon which running on windows

cd
nano .bashrc

add folowing at the end of file

# My config
cd
DOCKER_HOST=tcp://localhost:2375
if test -t 1; then
exec zsh
fi

press ctrl+x then y and enter. So now we saved file .bashrc.

What we did?

  • We configured WSL to Connect to Docker for Windows
  • We changed zsh like default shell

Install ZSH and 
Oh My ZSH on Ubuntu Bash Windows

cd
sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-completions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

chmod -R 755 $PWD/.oh-my-zsh/custom/plugins
git clone https://github.com/seebi/dircolors-solarized.git
nano ~/.zshrc
#to always reply Yes and automatically upgrade
DISABLE_UPDATE_PROMPT=true
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git
docker
zsh-autosuggestions
zsh-syntax-highlighting
zsh-completions
)
eval `dircolors ~/dircolors-solarized/dircolors.256dark`
#Change ls colours
LS_COLORS="ow=01;36;40" && export LS_COLORS

#make cd use the ls colours
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
autoload -Uz compinit
compinit

#alias for docker
alias docker-clean-unused='docker system prune --all --force --volumes'

alias docker-clean-all='docker stop $(docker container ls -a -q) && docker system prune -a -f --volumes'

alias docker-clean-containers='docker container stop $(docker container ls -a -q) && docker container rm $(docker container ls -a -q)'

installing powerline fonts for windows 10

git clone https://github.com/powerline/fonts.git

start Windows PowerShell as administrator and run file install.ps1

Checking

docker info
docker compose -version

Binding

for using file access between WLS and windows

mkdir /c
mount --bind /mnt/c /c

# unmount
umount /mnt/

or for
Windows 10 18.03 

cd \
nano /etc/wsl.conf.
[automount]
root = /
options = "metadata"

create sim link

ln -s /c/users/my_user/git /home/devuser/git
cd git

For better work with Linux console I recommend to use Linux terminal Hyper. You can read more in following article.

Leave a Reply

Close Menu