Connecting docker-machine to Azure using the generic driver

I have a Docker-based deployment on Azure. I know that docker-machine has a Azure driver, which can create VMs and generate the certs, etc.. But I’d rather use the Azure tools (CLI and portal).

So I created a VM, and installed my public SSH key on it. And now I’d like to connect to it using docker-machine. I add the server, so that I can see it when I do docker-machine ls:

  • How to access the moby linux kernel modules in Docker for Windows?
  • Forbid docker to use specific network
  • How to avoid reinstalling packages when building Docker image for Python projects?
  • Unable to connect to docker container
  • Where should environment-specific values be saved in a Laravel 5 application?
  • Contents in the container's bind-mounted dir keep unchanged after mounting/umounting removable drive from the host
  • NAME        ACTIVE   DRIVER       STATE     URL                        SWARM   DOCKER    ERRORS
    default     -        virtualbox   Stopped                                      Unknown
    serv        -        generic      Running   tcp://XX.XX.XX.XX:2376             Unknown   Unable to query docker version: Unable to read TLS config: open /Users/user/.docker/machine/machines/serv/server.pem: no such file or directory

    When I try to set the environment variables, I see this:

    $ docker-machine env serv
    Error checking TLS connection: Error checking and/or regenerating the certs: 
    There was an error validating certificates for host "XX.XX.XX.XX:2376": 
    open /Users/user/.docker/machine/machines/serv/server.pem: no such file or directory
    You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
    Be advised that this will trigger a Docker daemon restart which will stop running containers.

    When I try to regennerate-certs, I get:

    $ docker-machine regenerate-certs serv
    Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
    Regenerating TLS certificates
    Waiting for SSH to be available...
    Detecting the provisioner...
    Something went wrong running an SSH command!
    command : sudo hostname serv && echo "serv" | sudo tee /etc/hostname
    err     : exit status 1
    output  : sudo: no tty present and no askpass program specified

    I can SSH to the server fine.

    What’s the issue here? How can I make it work?

  • Can I restart a docker container listed in the docker ps -a output?
  • docker push to private registry: how not to specify a port
  • What is the best way to run an Ubuntu server on Windows with Docker and develop with an IDE?
  • Unable to install chef-server on docker container
  • Just created Docker Hub account, credentials do not work for “docker login”
  • How to deploy many instances of the same Docker image with unique database connection string
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.