Skip to content

Instantly share code, notes, and snippets.

@vedraiyani
Forked from SeanSobey/portainer.md
Created November 17, 2019 05:25
Show Gist options
  • Save vedraiyani/3fd69520b1060be6641adab385cae349 to your computer and use it in GitHub Desktop.
Save vedraiyani/3fd69520b1060be6641adab385cae349 to your computer and use it in GitHub Desktop.
Portainer Setup on Windows 10

Portainer on Windows 10

Here I have 2 methods for running portainer on windows, a quick, preferred method only requiring a fairly recent version of docker, or a more complicated method to try if that does not work.

Using docker.for.win.localhost

This setup will let you run Portainer on windows by using the docker.for.win.localhost endpoint.

Please note:

  • This will expose your docker API, without TLS, publicly from your machine.
  • For more advanced config see the portainer docs.

Step 1 Enable docker without TLS

Docker settings -> General -> Expose docker daemon on tcp://...

Step 2 Run Portainer Image

The only trick here is to use this endpoint: tcp://docker.for.win.localhost:2375.

Create portainer volume

Powsershell (admin):

docker volume create portainer_data

Create portainer container

With No Auth
docker run -d -p 3040:9000 --name portainer --restart=always -v portainer_data:/data portainer/portainer --no-auth -H tcp://docker.for.win.localhost:2375
With Auth
docker run -d -p 3040:9000 --name portainer --restart=always -v portainer_data:/data portainer/portainer -H tcp://docker.for.win.localhost:2375

Go to http://localhost:3040

To remove and revert all changes

Powsershell (admin):

docker stop portainer

docker rm portainer

docker rmi portainer/portainer

docker volume rm portainer_data

Using a loopback address (Fallback method)

This setup will let you run Portainer on windows by using a loopback address.

Please note:

  • Working with (current) Docker version 2.1.0.1, Windows 10 Build 18362.
  • YOU NEED TO BE ON LINUX CONTAINERS, this will not work on windows containers.
  • This will expose your docker API, without TLS, publicly from your machine.
  • For more advanced config see the portainer docs.

Step 1 Enable docker without TLS

Docker settings -> General -> Expose docker daemon on tcp://...

Find your docker API address

ipconfig -> Ethernet adapter vEthernet (DockerNAT): -> IPv4 Address -> eg: 10.0.75.1

This will be referred to as $DockerAddress.

Step 2 Create Looback Address

Powsershell (admin):

netsh interface portproxy add v4tov4 listenaddress=$DockerAddress listenport=2375 connectaddress=127.0.0.1 connectport=2375

Step 3 Allow Loopback through Firewall

Powsershell (admin):

netsh advfirewall firewall add rule name="Docker" dir=in action=allow protocol=TCP localport=2375 enable=yes profile=domain,private,public

OR, Manual version, create new firewall rule:

Firewall inbound rule:
	Rule Type: Port
	Protocol and Ports: TCP, 2375
	Action: Allow
	Profile: Domain, Private & Public
	Nname: docker-portainer

Edit Rule
	Scope, Remote IP address: 127.0.0.1

Step 4 Test Loopback

If the above steps were done correctly you should be able to see the docker API exposed on http://127.0.0.1:2375/ and http://10.0.75.1:2375/ (will just return a {"message":"page not found"} response).

Step 5 Run Portainer Image

Create portainer volume

Powsershell (admin):

docker volume create portainer_data

Create portainer container

With Auth
docker run -d -p 3040:9000 --name portainer --restart=always -v portainer_data:/data portainer/portainer

Go to http://localhost:3040 and add your endpoint (endpoint is: $DockerAddress:2375)

With No Auth

Powsershell (admin):

docker run -d -p 3040:9000 --name portainer --restart=always -v portainer_data:/data portainer/portainer --no-auth -H tcp://$DockerAddress:2375

Go to http://localhost:3040

To remove and revert all changes

Powsershell (admin):

docker stop portainer

docker rm portainer

docker rmi portainer/portainer

docker volume rm portainer_data

netsh interface portproxy reset

netsh advfirewall firewall delete rule name="Docker"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment