- Install Ubuntu on WSL 2 and set it the default distro
- Install docker desktop with WSL as backend plane for running containers.
- Go to settings of docker desktop -> Resources -> WSL Integration and enable the integration with Ubuntu distro and restart the docker from home page -> bottom left.
- Use the latest jenkins image from docker hub to run the jenkins container.
- Copy the run command from menu of container.
- Add the docker sock binding by adding the following to the run command:
–volume=/var/run/docker.sock:/var/run/docker.sock –volume=/usr/bin/docker:/usr/bin/docker –privileged - Open cmd and go to shell of ubuntu distro: wsl -d <distro-name>
- Paste the run command. You will have a new container running in ubuntu and will be visible in docker desktop GUI.
- Go to containers and click on the name of container for jenkins image. You will have the default password for jenkins installation in the Logs.
- Go to the browser and open the localhost:<port> and complete the Jenkins setup.
- Now you should be able to access the docker in jenkins shell command.
Backing you up.