1
0
mirror of https://github.com/docker/docs.git synced 2026-11-05 00:14:17 +03:00
Files
docs/commands/ssh.go
Nathan LeClaire c8edb33ecd Move towards using external binaries / RPC plugins
- First RPC steps

- Work on some flaws in RPC model

- Remove unused TLS settings from Engine and Swarm options

- Add code to correctly encode data over the network

- Add client driver for RPC

- Rename server driver file

- Start to make marshal make sense

- Fix silly RPC method args and add client

- Fix some issues with RPC calls, and marshaling

- Simplify plugin main.go

- Move towards 100% plugin in CLI

- Ensure that plugin servers are cleaned up properly

- Make flag parsing for driver flags work properly

Includes some work carried from @dmp42 updating the build process and
tests to use the new method.

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2015-10-16 16:34:56 -07:00

40 lines
687 B
Go

package commands
import (
"github.com/docker/machine/cli"
"github.com/docker/machine/libmachine/state"
)
func cmdSsh(c *cli.Context) {
args := c.Args()
name := args.First()
if name == "" {
fatal("Error: Please specify a machine name.")
}
store := getStore(c)
host, err := loadHost(store, name)
if err != nil {
fatal(err)
}
currentState, err := host.Driver.GetState()
if err != nil {
fatal(err)
}
if currentState != state.Running {
fatalf("Error: Cannot run SSH command: Host %q is not running", host.Name)
}
client, err := host.CreateSSHClient()
if err != nil {
fatal(err)
}
if err := client.Shell(c.Args().Tail()...); err != nil {
fatal(err)
}
}