How to use docker-machine on a private server?

I want to install docker hosts on a server running CentOS7(that’s running in Virtualbox on my PC if it matters).

I’m aware that there are drivers for multiple cloud providers (Amazon, Google, DigitalOcean etc) but I can’t figure out what to do if I want to use my own private server.

  • Enterprise private Docker registry best practices [closed]
  • standard_init_linux.go:178: exec user process caused “exec format error”
  • LINKERD: Unable to build docker image from linkerd
  • Running wine in ubuntu docker container
  • Unable To Disconnect Docker Container From Network
  • Strategy for versioning Docker images linked to other contains via docker compose
  • I’ve tried using --driver generic with the guest OS’s IP, and an SSH key I created and copied using ssh-keygen and ssh-copy-id but I got

    $ docker-machine create -d generic --generic-ip-address=<IP> --generic-ssh-key ~/.ss
    h/id_rsa --generic-ssh-user <user> centos
    Running pre-create checks...
    Creating machine...
    (centos) Importing SSH key...
    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...
    Provisioning with centos...
    Error creating machine: Error running provisioning: exit status 1

    What am I doing wrong?

    Can it have something to do with the fact that I installed CentOS in Virtualbox?

  • karma phantomjs not capturing in docker container
  • Running an Oracle XE Docker image on a Redhat Host
  • How to handle database storage/backup and application logs with many linked containers?
  • Setting Rails Environment for Apache by Environment Variable
  • Why install docker on ubuntu should be `sudo apt-get install`?
  • Upgrade docker-compose version on windows 7
  • One Solution collect form web for “How to use docker-machine on a private server?”

    Yes you can use docker-machine to provision and control docker-engine on a linux server, i.e. import an existing linux server as a Docker Machine. There are several requirements for this:

    1. Only a few OS are supported, see Support for CentOS is experimental at the moment
    2. Your SSH key need to be either without password, or managed by ssh-agent.
    3. Your user account on the server need to be able to run sudo without password (see this link on how to do it)

    Once the requirements are satisfied, you can import your server as a Docker Machine using one of the methods below

    1. If your SSH key has no password

      docker-machine create -d generic --generic-ip-address server-ip --generic-ssh-key key-file --generic-ssh-user username machine-name
    2. If you use ssh-agent to manage your key

      docker-machine create -d generic --generic-ip-address server-ip --generic-ssh-user username machine-name

    Then you’ll be able to use docker-machine commands on your local machine to control this remote server. This means that you can start, stop, kill, restart the server, so use it with extreme caution

    Also, in general, due to the requirements listed at the beginning, and the fact that you’ll be able to stop or kill the server, I would NOT recommend doing this. It is much safer to SSH into your server and do everything from there.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.