-
Notifications
You must be signed in to change notification settings - Fork 2k
Implement more shareable serialization logic for config.json #2516
Comments
👍 |
👍 definitely good to have! @nathanleclaire Just wondering if this there would be a separate / sub-cmd on the lines of |
It will be an "internal feature" at first, but is a first step to having an artifact that one can move from computer-to-computer and it keeps working. |
+1 also to |
+1 |
+1 just ran into this. Would be great to have an export/import config command. |
+1 |
Any updates on this? |
👍 |
+1 Bump on this - anyone have an update on this? |
Any update on this feature? |
Any news? |
any news? |
not the cleanest or most secure, but RSYNC the whole .docker folder on your machine and it's a replica HOWEVER there's not really a good way to do this for mobile devices that I've found... |
👍 |
This is a proposal to deal with a variety of problems around sharing configurations from computer to computer.
Problem
Currently if one creates a server using Docker Machine, a new folder is created on their computer containing
config.json
(description of the machine) and secrets associated with that machine. To use this same configuration on another computer is not straightforward, largely because moving the folder to the same path on another machine does not guarantee that the OS paths will be translated correctly.For instance, a user might have their
CaCertPath
at/Users/nathanleclaire/.docker/machine/certs/ca.pem
, but on another computer theStorePath
might beC:\Users\nathan\.docker
.Proposal
This could potentially be mitigated by implementing a custom type with custom JSON marshal and unmarshal logic using Golang's
JSONMarshaler
andJSONUnmarshaler
interfaces.This would allow us to have a "universal translation layer" for pathing. Likewise,
Code speaks louder than words, so here's an example:
Output:
Link to playground version: http://play.golang.org/p/fbR-k8nItm
For instance, we could use this to normalize the paths to always have the same type of slashes like mentioned in #2509
If this is implemented properly, we can ensure that the user's
StorePath
will always be set correctly when loaded, no matter where the store they happened to move their machine folder to is.Potential issues
Seems like this isn't a particularly risky move, but the most annoying bit would be to update all of our code to use
FSPath
instead of vanillastring
, which is certainly a decent chunk of overhead and decently risky given some issues around serialization and migration that we've had in the past.Future
One of the reasons I think this could be nice to implement is that it could set a precedent for doing this in other areas as well. For instance, to keep API credentials encrypted when they are on disk and prompt for a password before decrypting them in the
Unmarshal
step (as just one suggestion of many possibilities).Related issues / PRs:
cc @docker/machine-maintainers What do you think about this solution?
The text was updated successfully, but these errors were encountered: