Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export Docker-machine configuration to be used on other machines

What's the best way to move docker-machine machines (remote not local host) from one computer to another (osx to windows). I have to change the config.json files for all the machines so it works on another computer, because the path to the certs and machine are all hardcoded in the config file.

while this approach works, it's a bit tedious if we need to share them with everyone on the team. Is there a way to export or import the machine? or there are other ways to archive what I am trying to do.

like image 217
Eatdoku Avatar asked May 11 '15 16:05

Eatdoku


People also ask

How do I export and import a docker container?

To import an exported container as an image, we use the docker import command. The documentation describes import as follows: docker import – Import the contents from a tarball to create a filesystem image. As you can see, Docker happily runs our exported file system, which we can then attach to and explore.

What command can be run to import a pre exported docker image into another docker host?

Q8. Which command is used to import a pre-exported Docker image into another Docker host? Ans. We can import a pre-exported Docker image into another Docker host using the docker load command.


1 Answers

Until this feature gets implemented natively (see Issue 23), you can use this import/export script I've written.

https://gist.github.com/schickling/2c48da462a7def0a577e

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1

$ ./docker-machine-export.sh dev
Exported machine to dev.zip

$ ls
docker-machine-import.sh
docker-machine-export.sh
dev.zip

Import (on host B)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS

$ ./docker-machine-import.sh dev.zip
Exported machine to dev.zip

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
like image 200
schickling Avatar answered Sep 30 '22 02:09

schickling