@@ -85,12 +85,13 @@ will need to make sure it is compliant with the Docker license terms (non-GPL).
8585For more information, contact a project maintainer.
8686
8787# Implementation
88- The following describes what is needed to create a Machine Driver.
88+ The following describes what is needed to create a Machine Driver. The driver
89+ interface has methods that must be implemented for all drivers. These include
90+ operations such as ` Create ` , ` Remove ` , ` Start ` , ` Stop ` etc.
8991
90- As mentioned, please review the [ Driver Interface] ( https://github.com/docker/machine/blob/master/drivers/drivers.go#L23 ) for full details .
92+ For details see the [ Driver Interface] ( https://github.com/docker/machine/blob/master/drivers/drivers.go#L24 ) .
9193
92- ## Definition
93- All drivers use a struct for its basic definition:
94+ To provide this functionality, most drivers use a struct similar to the following:
9495
9596```
9697type Driver struct {
@@ -142,71 +143,6 @@ func GetCreateFlags() []cli.Flag {
142143}
143144```
144145
145- You will then need to implement the various methods defined in the Driver
146- interface:
147-
148- ```
149- // AuthorizePort authorizes a port for machine access
150- AuthorizePort(ports []*Port) error
151-
152- // Create a host using the driver's config
153- Create() error
154-
155- // DeauthorizePort removes a port for machine access
156- DeauthorizePort(ports []*Port) error
157-
158- // DriverName returns the name of the driver as it is registered
159- DriverName() string
160-
161- // GetIP returns an IP or hostname that this host is available at
162- // e.g. 1.2.3.4 or docker-host-d60b70a14d3a.cloudapp.net
163- GetIP() (string, error)
164-
165- // GetMachineName returns the name of the machine
166- GetMachineName() string
167-
168- // GetSSHHostname returns hostname for use with ssh
169- GetSSHHostname() (string, error)
170-
171- // GetSSHKeyPath returns key path for use with ssh
172- GetSSHKeyPath() string
173-
174- // GetSSHPort returns port for use with ssh
175- GetSSHPort() (int, error)
176-
177- // GetSSHUsername returns username for use with ssh
178- GetSSHUsername() string
179-
180- // GetURL returns a Docker compatible host URL for connecting to this host
181- // e.g. tcp://1.2.3.4:2376
182- GetURL() (string, error)
183-
184- // GetState returns the state that the host is in (running, stopped, etc)
185- GetState() (state.State, error)
186-
187- // GetProviderType returns whether the instance is local/remote
188- GetProviderType() provider.ProviderType
189-
190- // Kill stops a host forcefully
191- Kill() error
192-
193- // PreCreateCheck allows for pre-create operations to make sure a driver is ready for creation
194- PreCreateCheck() error
195-
196- // Remove a host
197- Remove() error
198-
199- // Restart a host. This may just call Stop(); Start() if the provider does not
200- // have any special restart behaviour.
201- Restart() error
202-
203- // SetConfigFromFlags configures the driver with the object that was returned
204- // by RegisterCreateFlags
205- SetConfigFromFlags(flags DriverOptions) error
206-
207- // Start a host
208- Start() error
209-
210- // Stop a host gracefully
211- Stop() error
212- ```
146+ ## Examples
147+ You can reference the existing [ Drivers] ( https://github.com/docker/machine/tree/master/drivers )
148+ as well.
0 commit comments