Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Add a docker-machine reinstall#3898

Open
ayufan wants to merge 1 commit intodocker-archive-public:masterfrom
ayufan:add-reinstall-command
Open

Add a docker-machine reinstall#3898
ayufan wants to merge 1 commit intodocker-archive-public:masterfrom
ayufan:add-reinstall-command

Conversation

@ayufan
Copy link
Copy Markdown
Contributor

@ayufan ayufan commented Nov 29, 2016

This commands allows to use a cloud instance API to schedule reinstall of machine, by completely wipping its content and then re-provisioning.

This PR is created as proof-of-concept supports only DigitalOcean reinstall API, but quite easily any other API can be supported.

This is the output of command execution on existing machine:

Stopping "kamil-gitlab-test-reinstall"...
Reinstalling "kamil-gitlab-test-reinstall"...
Waiting for "kamil-gitlab-test-reinstall" to become Running...
Machine "kamil-gitlab-test-reinstall" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...

This feature is needed by GitLab Runner docker-machine based auto-scaling to make it possible to re-use existing machines.

What do you think of this? Is this something worth and mergeable (if improved)?

@GordonTheTurtle
Copy link
Copy Markdown

Please sign your commits following these rules:
https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "add-reinstall-command" git@github.com:ayufan/docker-machine.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@nathanleclaire
Copy link
Copy Markdown
Contributor

Hmm... I dunno, I would think something like docker-machine import --digitalocean-id ... existingbox, docker-machine provision existingbox might be more apropos, no?

@ahmetb
Copy link
Copy Markdown
Contributor

ahmetb commented Dec 2, 2016

Agreed, reinstall is completely cryptic, especially when it's supported only by 1 out of 15 drivers.

to make it possible to re-use existing machines.

In this case, does DigitalOcean actually wipe all the data in the machines (including docker certs) and burn the clean base OS image to the droplet's disk? If so, I would suggest calling the RebuildByImageSlug on your side and then using docker-machine import or docker-machine create -d generic as Nathan suggested.

@nathanleclaire
Copy link
Copy Markdown
Contributor

To be clear, import is not an existing feature, rather something I've thought might be nice for a while (bring your own existing machines based on instance ID), in this case I'm a bit confused why not just create a new machine if you're going to wipe out the whole OS anyway.

@ayufan
Copy link
Copy Markdown
Contributor Author

ayufan commented Dec 2, 2016

nathanleclaire: because of cost, if you destroy machine and re-create it often you are hit by full billing cycle.

Yes I saw that this is only supported by Digital Ocean.

Probably it doesn't make sense to introduce a feature just for one provider.

@nathanleclaire
Copy link
Copy Markdown
Contributor

What's the motivation for wanting to wipe the machine's state? i.e., why is not provision alone sufficient?

@ayufan
Copy link
Copy Markdown
Contributor Author

ayufan commented Dec 2, 2016

nathanleclaire: we (at GitLab) use docker-machine to provision nodes on-demand for running CI jobs, since these nodes do run docker containers in privileged mode we have to wipe them before running another untrusted job

@nathanleclaire
Copy link
Copy Markdown
Contributor

Hm, yeah, I wonder if it might be a slightly better fit to run a little container which makes the DigitalOcean API call to wipe the machine on its own.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants