Docker-Machine with windows VM on AWS

So I am trying to create an AWS gitlab-runner that would auto-scale with AWS instances with the amazonec2 driver and docker-machine.
It seems that Gitlab-runner is using docker-machine as its way of creating vm and wants to send the job to them after.
I’d like the VM docker host to run windows containers so the VM I spawn with docker-machine has a windows AMI.

The instance gets started correctly on AWS but it gets stuck on the message:
Waiting for ssh to become available…

So I am wondering if all of this is possible at all. Docker-machine doesn’t seem to ssh into the windows container and even, ssh-ing into a windows container looks like weird to me. I am not sure I should try to do this at all and are not finding a lot of results on docker-machine windows vms.

Is it possible to create a docker-machine windows vm? And how docker-machine connects to it?

2 Likes

I’m very interested in exactly the same thing. I’m currently using amazonec2 driver successfully for linux machines, would love the same to work for windows as well.

I haven’t tried it yet but this may be another option: https://github.com/jeffellin/machine-cloudformation

@jpnolin @alelec Did either of you get anywhere with this?

Due to restrictions on the number of links in a post for new users like me, I’ve put the meat of my comment on Gist. In brief:

  • Amazon Windows AMIs do not come with SSH
  • It is possible to create your own Windows AMI with SSH
  • Docker Machine will connect to a Windows machine over SSH, but does not know how to “provision” it once it connects

Are there any updates on this?

I got as far as @thejohnfreeman but once docker-machine is able to connect to the host, it fails trying to provision it:

Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Error creating machine: Error detecting OS: Error getting SSH command: ssh command error:
command : cat /etc/os-release
err     : exit status 1
output  : 'cat' is not recognized as an internal or external command,
operable program or batch file.

I also encountered the same difficulties
Is there any update to this

Running pre-create checks...
Creating machine...
(TestConsole) Launching instance...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
docker-machine : Error creating machine: Error detecting OS: Error getting SSH command: ssh command error:
At line:2 char:1
+ docker-machine create `
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Error creating ... command error::String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
command : cat /etc/os-release
err     : exit status 1
output  : 'cat' is not recognized as an internal or external command,
operable program or batch file.

Docker machine just simply doesn’t support provisioning Windows machines. And since it’s been officially deprecated for a number of years, I doubt that it will ever happen. I’m not sure that the GitLab fork maintainers would even accept the feature if someone had time to implement it, since they seem to be focused on supporting only critical bugs in the current codebase.

As an alternative, I’ve been looking into autoscaling GitLab CI runners on Windows using AWS Fargate: Autoscaling GitLab CI on AWS Fargate | GitLab