Continental setup WSL 2 with Proxy, with Docker install


Created: 02 Dec 2022, 03:37 PM | Modified: =dateformat(this.file.mtime,"dd MMM yyyy, hh:mm a") Tags: knowledge, unix


Go to “Turn Windows features on and off”

Scroll down list to “Windows Subsystem for Linux” and “Virtual Machine Platform” and select it if it’s unselected. Please note that this step requires a system restart.

In cmd:

wsl —set-default-version 2

wsl —install -d Ubuntu

wsl -l -v

Should see:

Connectivity via VPN

In case you have a VPN client installed, your WSL VM will not have access to the internet. Therefore, it is required to provide network connectivity (WSL’s acces to the network may be missing, even if VPN status is “Disconnected”). There is a solution provided here:GitHub - sakai135/wsl-vpnkit: Provide network connectivity to WSL 2 when blocked by VPN. Please follow the installation instructions.

Now, when you execute the command wsl —list, you should have something like this:

Windows-Subsystem für Linux-Distributionen:

Ubuntu (Standard)

wsl-vpnkit

Since the documentation of the WSL VPNKit is not so clear: you have to start the distribution (here Ubuntu) and add the following to~/.bashrc:

# enable host VPN for WSL

wsl.exe -d wsl-vpnkit service wsl-vpnkit start

This will automatically enable the network connectivity through VPN for this distribution.

From <https://confluence.auto.continental.cloud/display/projectAI/Windows+Subsystem+for+Linux%3A+Installation>

Deploy Conti CA Certificates

  • Update Certs

sudo apt install ca-certificates

sudo update-ca-certificates

From <https://confluence.auto.continental.cloud/display/DLI/DEV+Environment+-+VirtualBox+%7C+Ubuntu#DEVEnvironmentVirtualBox%7CUbuntu-DeployContiCACertificates>

update

$ sudo nano /etc/environment

PATH=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games”

http_proxy=“http://sia-proxy-basic.geo.conti.de:3128

https_proxy=“http://sia-proxy-basic.geo.conti.de:3128

no_proxy=localhost,127.0.0.1,10.,.conti.de,.contiwan.com,conti.de,contiwan.com,eu.artifactory.conti.de,eu-test.artifactory.conti.de,github.conti.de

See https://connext.conti.de/wikis/home?lang=en-us#!/wiki/W599b200efaef_4700_9ca0_22456921e5ef/page/acc3de0d-80d9-4899-a864-dee3b8fa4d31 for proxy details

Then call

$ set -a; source /etc/environment; set +a;

Then exit wsl distro, call wsl —shutdown, and restart wsl

Test with wget google.com

Should respond with some index.html

Then install docker with

<<install_docker.sh>>

*#/bin/bash*

sudo apt-get update

sudo apt-get install

ca-certificates

curl

gnupg

lsb-release

sudo mkdir -p /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg —dearmor -o /etc/apt/keyrings/docker.gpg

echo

“deb [arch=$(dpkg —print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu

$(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

docker run hello-world

Copy this file into ~/.docker (not needed for WSL! Needed for new account in googoo/dreamcore/aftershock)

<<config.json>>

{

“proxies”:

{

“default”:

{

“httpProxy”: “http://localhost:3128”,

“httpsProxy”: “http://localhost:3128”,

“noProxy”: “.conti.de,127.0.0.0/8,localhost,10.*,.contiwan.com”

}

}

}

Add user to docker group

sudo usermod -a -G docker <user_name>

Every startup must call -

sudo service docker start

Test with

docker run hello-world

Set Docker to start on boot

#Windows 11 version
sudo su -
sudo touch /etc/wsl.conf
sudo chmod 777 /etc/wsl.conf
sudo echo "[boot]
command="/etc/init.d/docker start"" > /etc/wsl.conf

You might setup some more suitable permissions than chmod 777, chmod was only given to ensure the test works

#If in Windows 10 echo "

NonInsidersVersion

if service docker status 2>&1 | grep -q “is not running”; then wsl.exe -d ”${WSL_DISTRO_NAME}” -u root -e /usr/sbin/service docker start >/dev/null 2>&1 fi” >> ~/.profile

From <https://securecloud.blog/2021/12/07/wsl2-use-docker-with-vscode-without-docker-desktop/>

GPU / CUDA availability