See final versions without trash here
-
Download necessary version of docker binaries from https://docs.docker.com/engine/install/binaries/ and extract archive to
c:/Program Files
, for example, using script in powershell. Run powershell as Administrator and call:Expand-Archive .\docker-20.10.9.zip -DestianationPath $Env:ProgramFiles
Files
docker.exe
anddockerd.exe
will be herec:/Program Files/docker/
.We need only docker.exe and do not need
dockerd.exe
because it can start only Windows containers. To check it you can try to call as Admindockerd.exe
and thendocker.exe pull ubuntu
. Expected result:no matching manifest for windows/amd64 10.0.19043 in the manifest list entries
-
Add path
c:/Program Files/docker
to environment variable PATH. It could be done with this powershell script:[Environment]::SetEnvironmentVariable("Path",$env:Path + ";c:/Program Files/docker", "Machine")
-
Install docker under Ubuntu WSL using these instructions https://docs.docker.com/engine/install/ubuntu/
-
To provide ability to call
docker
in WSL withoutsudo
add current user todocker
groupsudo groupadd docker sudo usermod -aG docker $USER
-
Configure dockerd to run over http with access from Windows
⤵️ Edit/etc/profile
function rundocker(){ ## Use this variant in case when `localhostForwarding` in `/etc/wsl.conf` is unset or equal to `false` #DOCKER_HOST=`ifconfig eth0 | grep -E "inet ([0-9]{1,3}.){3}[0-9]{1,3}" | head -1 | awk '{ print $2 }'` DOCKER_HOST=localhost WIN_CLIENT="/mnt/c/Program Files/docker/docker.exe" "$WIN_CLIENT" context rm -f wsl > /dev/null "$WIN_CLIENT" context create wsl --description "dockerd in WSL" --docker "host=tcp://$DOCKER_HOST:2375" "$WIN_CLIENT" context use wsl sudo dockerd -H $DOCKER_HOST -H "unix:///var/run/docker.sock" --tls=false } export -f rundocker
Details...
⚠️ Be aware of this warnings:Binding to IP address without --tlsverify is insecure and gives root access on this machine to everyone who has access to your network. host="tcp://172.27.117.140:2375" Binding to an IP address, even on localhost, can also give access to scripts run in a browser. Be safe out there! host="tcp://172.27.117.140:2375"
⤵️ Run docker daemon on Windows startup using Task Scheduler (taskschd.msc)$task = New-ScheduledTaskAction -Execute "C:\Windows\System32\wsl.exe" -Argument '-u root bash -c "(source /etc/profile && rundocker &) && sleep 10"' $trigger = New-ScheduledTaskTrigger -AtLogon $settings = New-ScheduledTaskSettingsSet -DontStopIfGoingOnBatteries -AllowStartIfOnBatteries Register-ScheduledTask RunDocker -Action $task -Trigger $trigger -Settings $settings
⤵️ To stop docker daemon manuallysudo kill $(ps faux | grep 'dockerd' | grep -vw grep | awk '{ print $2 }')
sudo apt-get install -y python3 python3-pip
pip3 install --user docker-compose
~/.bashrc
if it has not still done.
export DOCKER_HOST=tcp://localhost:2375
TypeError: load_config() got an unexpected keyword argument 'config_dict'
try to call scripts:
pip3 uninstall docker-compose
pip3 uninstall docker-py docker
pip3 install --user -U docker-compose
See Setting Up Docker for Windows and WSL to Work Flawlessly
I caught error
Error: net::ERR_CONNECTION_REFUSED at http://host.docker.internal:6006?path=...
withdocker-chromium
having run underjet-puppeteer-docker
in Jetbrains Idea (only there). The only way to fix it was found:
- Install Docker Desktop and clone folder
c:\Program Files\Docker
asc:\Program Files\Docker_
. After that Docker Desktop can be removed. - Then make steps above to unpack binaries. Then copy with a replace files
docker.exe
andcom.docker.cli.exe
fromc:\Program Files\Docker_\Docker\resources\bin\
toc:\Program Files\Docker
. - I do not know why it is so. Despite
docker.exe
is just client todockerd
in WSL, but it makes some difference. When we use not-patched version ofdocker.exe
then/etc/hosts
does not contains needed alias. But when we use patched version ofdocker.exe
from Docker Desktop (with requiredcom.docker.cli.exe
) then it gets OK. I suggested that a problem is hidden in difference of versions and checked it. Probably, Nope.Docker 20.10.10, build b485636
from Docker DesktopDocker 20.10.9, build c2ea9bc
from binariesDocker 20.10.10, build b485636
from binaries
- At the same time do not touch
docker-compose.exe
, leave original version
- Get kubectl
- Prepare context
kubectl config set-cluster xyz --insecure-skip-tls-verify --server=https://api.${K8S_HOST}:${K8S_PORT}
kubectl config set-credentials xyz-admin --token=${K8S_USER_TOKEN}
kubectl config set-context xyz --cluster=xyz --user=xyz-admin
kubectl config use-context xyz
- Use Intellij Idea plugin to access
Ubuntu 22.04
microsoft/WSL#6655 (comment)
Solution: