Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename docker machine

Tags:

How can I rename a docker-machine machine? I can't find it using docker-machine --help or in the subcommand docs.

like image 604
Dag Høidahl Avatar asked Dec 01 '15 14:12

Dag Høidahl


People also ask

Can I rename docker container?

To rename docker container, use the rename sub-command as shown, in the following example, we renaming the container discourse_app to a new name disc_app. After renaming a containers, confirm that it is now using the new name.

Which command can be used to rename a docker image?

You can rename your docker image by docker tag command.


1 Answers

Basically you have to:

  1. rename the directory of your docker-machine from docker machine store (usually in /.docker/machine/machines/ )
  2. update config.json with the new name and new path
  3. rename machine in the virtual machine provider (VirtualBox, VMware, etc.)

Here is a gist for VirtualBox. With this you can rename machines like this docker-machine-rename default my-default

This will only work if you are using VirtualBox. If you are using paralells driver or something else you have to replace vboxmanage ... with the appropriate command for that driver

EDITED I updated the script after receiving feedback from @DagHøidahl

like image 170
Alex Proca Avatar answered Sep 19 '22 13:09

Alex Proca