Rss

Archives for : windows

Docker on Windows 10 Anniversary – [updated]

So Windows 10 Anniversary is out and it brings with it Containers!

Most likely if you’re like me and already interested in docker, you’ll have installed the Docker App from docker.io and will be wondering why the instructions don’t work.

Basically the docker app for windows doesn’t currently support Windows containers.

If you run docker version you can see why:

The server is running linux. No hosting Windows containers in that.

Now I could uninstall the current docker app and then follow the instructions, but really I want to just quickly try out docker windows containers but also keep using my linux containers.

How I got it working was to tweak the instructions a bit:

  • From the System Tray, right-click on docker and select “Exit Docker”
  • In powershell stop the docker service  Stop-Service com.docker.service
  • Download the Windows container service (ensure you have a c:\temp folder):
  • CD into the c:\temp folder and extract this archive:
  • There are 3 files in the new “docker” folder: docker.exe (which is the same as in the Windows docker app), docker-proxy and dockerd.exe. We need dockerd.exe
  • Register this new dockerd service and start it:
  • Once you start the new docker service you’ll see:

Now your windows nanoserver container will happily install and as per the original instructions:

Unfortunately for me, it just hangs here, and does absolutely nothing. In the end I have to kill the docker.exe process and stop the service.

So still waiting on getting working containers on Windows.

To remove the Windows container service, and return to linux, stop the windows container service (optionally un-register it)

Then start the Docker app service again, the run “Docker for Windows” app again to start the Mobylinux host.

Resolved

Update to the latest version:

 

Docker & PHP – on Windows

Deciding I needed to learn more about docker and finally start using it, I decided to give it a little try.

Docker on Windows… not so quick

A recent application I downloaded wanted to install an entire WAMP (Windows-Apache-MySQL-PHP) stack on my computer. There’s no way I’m having all of that installed and running.

I knew this was possible in docker, so I thought I’d start my foray into docker land with creating my own WAMP stack. It turned out to be more a VDLNMP stack; as you’ll see.

After much searching amid a very log signal-to-noise ratio, I finally found an excellent tutorial at a place called osteel’s blog.

I was merrily following along until the instruction came to mount the local dev folder into the docker container. Now I’m running on Windows, so I’m using docker machine, and after some searching discovered that docker machine just doesn’t work like that.

I’d have to somehow copy my dev folder to VM that’s hosting the docker containers and then mounting wherever that folder is into the running containers. Too much indirection for me.

Vagrant to the rescue

I then remembered that vagrant forwards local folders very nicely, and into a very predictable location. I also remembered that vagrant supports docker as a provisioner, even better a quick search turned up that there’s a docker-compose plugin for it as well.

I quickly built a very simple vagrant file:

Followed by vagrant up and, lo and behold, everything just worked.

What’s Happening?

  • The vagrantfile uses the basic ubunty box.
  • It then provisions by installing docker & docker-compose
  • The final two options on docker_compose are:
    • the docker-compose.yml to run (it allows multiples)
    • always run this provisioner, e.g. on vagrant reload

Finally to make my life easier I forward the ports on the vagrant box where my containers are running to my local machine.

The full project is available in GitHub.

VDLNMP: Vagrant-Docker-Linux-Nginx-MySQL-PHP