NAV on Docker with Portainer

NAV on Docker with Portainer

29. Juli 2017

NAV on Docker with Portainer

When you get used to it, working with the CLI for Docker / Windows Containers is quite easy but having a GUI is more convenient, especially for newcomers. A very good GUI for Docker / Windows Containers is  Portainer, which is free and you can get services and support from the company behind it. I struggled for quite some time to get it up and running because a) the Docker community is still very Linux-dominated with Windows Containers being the newcomer and b) I had some trouble configuring the connection with our company proxy. Let me show you what needs to be done and how easy it is to get your NAV environment up and running with something like this as a result:


According to the Portainer documentation it should be possible to set an internal port proxy to access the Docker API from the Portainer Container like this

netsh interface portproxy add v4tov4 listenaddress= listenport=2375 connectaddress= connectport=2375
docker run -d -p 9000:9000 portainer/portainer -H tcp://

However I was unable to get this up and running1  and ended up doing the following which is a security problem as it makes the API available from your whole network, so you might not want to do that, but I didn’t find another way to get it done:

  1. Bind the API port to all IPs by changing C:\ProgramData\docker\config\daemon.json to
        "hosts": ["tcp://", "npipe://"]
  2. Create a transparent network which we will then use for the Portainer container
    docker network create -d transparent MyTransparentNetwork
  3. Run the Portainer container with
    docker run -d --network=MyTransparentNetwork --name portainer --hostname portainer portainer/portainer
  4. Open portainer at http://portainer:9000
  5. Enter [containerhost]:2375 as your endpoint

Not exactly straight forward but it might be easier for you if you don’t have a mandatory proxy and also this might be the last time you use the CLI… 🙂

Actually using Portainer

If you have come that far you now have a nice web interface to work with your containers. You can pull images, create new containers, see the status and log entries of running containers, manage them and even a get a session inside the container within your browser:

Now how about running NAV inside it? Microsoft is starting to work with Docker (actual scope not yet defined) as you might have noticed when checking the agendas for Directions EMEA and TechDays (Directions NA to follow)2, therefore I am in the following not using Jakub Vanak’s excellent repo as in previous posts but a private one by Freddy Kristiansen of Microsoft. But you can achieve the same with either your own Dockerfiles or Jakub’s.

You can manually enter the necessary parameters in the GUI or you can use my template definitions by entering https://raw.githubusercontent.com/tfenster/templates/nav-and-iis/templates.json through Settings > Use custom templates > URL. With that you get three new templates with two being of interest for this scope: One for a generic NAV image where you have to provide your own DVD, one for the current dev environment (keep in mind that this is a Container, so you still need to install and setup your client).

If you have those in place, it really is incredibly easy to get your dev environment up and running. I’ve shortened the wait times a bit as you can see if you look at the timestamps but still from intialization to being ready for connections it takes about half a minute and from selecting the template to being ready it takes approximately a minute:

Before you can login you need to enter the Container either through the session feature in Portainer or by entering a PowerShell session as described here and calling

net user <login> <password

You could do that in Portainer but as everyone with admin access could then read your password, you probably don’t want to do that.

I really like the new possibilites Docker / Windows Containers bring from a development as well as from a production / hosting standpoint and really am happy how the NAV team is among the “early adopters” inside Microsoft. Just think back three years and here we are now, running NAV in the Cloud as full SaaS solution and also having it inside Windows Containers. Microsoft from my point of view is really moving in the right direction!

  1. This might be connected with the problem that I had to add our company proxy to enable pulling images from the Internet. This can done with

    [Environment]::SetEnvironmentVariable(“HTTP_PROXY”, “http://ip:port, [EnvironmentVariableTarget]::Machine)

    where you need to make sure to set the Target to Machine as otherwise at least in my experience the Docker service won’t pick that setting up. I played with overwriting the HTTP_PROXY and NO_PROXY environment variables just for the Portainer container but couldn’t get it to work that way

  2. Freddy Kristiansen is hosting those sessions and even a workshop with Jakub Vanak and me, so drop by if you are at Directions EMEA or TechDays (I won’t be at NA)!