docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.97k forks source link

Share a docker-machine on multiples machines #3861

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi,

I create a amazonec2 docker-machine to deploy an application, so I can manage this docker-machine locally.

But is it possible to share this docker-machine on other machine in order to work with other developers?

Something like a docker-machine pull?

easybe commented 7 years ago

I agree, this is one of the biggest flaws of docker-machine. Has nobody come up with a concept for this yet? The solution I found so far to manage a server from multiple clients is to use the same CA certificate by setting MACHINE_TLS_CA_KEY and MACHINE_TLS_CA_CERT and copying ~/docker/machine/machines/the_machine between the hosts and editing config.json accordingly.

hholst80 commented 7 years ago

@easybe a first step could be to get docker-machine run against a NFS share or similar. Remapping the config directory (~/.docker/machine) to some shared place on the network (/nfs/machine) do you think that would work?

EDIT: It seems that the required functionality is mostly in place already. By creating a wrapper for docker-machine which sets some environment variables it should be possible to run a single shared docker-machine storage. Assume the shared nfs path is /efs like on AWS:

#!/bin/bash
# /efs/bin/docker-machine wrapper

export MACHINE_STORAGE_PATH=/efs/machine
export MACHINE_DRIVER=amazonec2
# export AWS_ACCESS_KEY_ID=…
# export AWS_SECRET_ACCESS_KEY=…
export AWS_INSTANCE_TYPE=c4.4xlarge
export AWS_DEFAULT_REGION=us-east-1
export AWS_SSH_KEYPATH=/efs/ssh/id_rsa
export AWS_INSTANCE_TYPE=c4.4xlarge
export AWS_DEFAULT_REGION=us-east-1

# Parse pre-command arguments
# Parse main command and override "create" to provision machine (setup additional packages etc.)
# Defer all other commands to /efs/bin/docker-machine.wrapped