Portainer on WSL2

I’ve been using WSL2 for developping for both personal and Professional use cases. To manage and quick deploy the containers, i’ve been using Portainer. As much as i love to use Terminal, i’m mostly lazy.

I’m assuming you’ve already WSL2 installed and docker is up and running.

First create a volume with following.

$ docker volume create portainer_data

Now, install portainer

$ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

Here, Port 9000 is used for serving UI and API. Port 8000 is for running SSH tunnel between portainer instance and the agent.

Now, set a admin password

Now, Select Docker as Environment and click Connect

Here it is,

To pull images from Dockerhub go to images on left menu, type in the name of the container and tag e.g node:current-alpine3.10. click on Pull the Image.

you can import of your own container and spin off the containers.