Exec runs the provided command against the docker container specified by this service.
(command Command, opts ...ExecOption)
| 650 | // Exec runs the provided command against the docker container specified by this |
| 651 | // service. |
| 652 | func (d *dockerRunnable) Exec(command Command, opts ...ExecOption) error { |
| 653 | if !d.IsRunning() { |
| 654 | return errors.Newf("service %s is stopped", d.Name()) |
| 655 | } |
| 656 | |
| 657 | l := &LinePrefixLogger{prefix: d.Name() + "-exec: ", logger: d.logger} |
| 658 | o := ExecOptions{Stdout: l, Stderr: l} |
| 659 | for _, opt := range opts { |
| 660 | opt(&o) |
| 661 | } |
| 662 | |
| 663 | args := []string{"exec", d.containerName()} |
| 664 | args = append(args, command.Cmd) |
| 665 | args = append(args, command.Args...) |
| 666 | cmd := d.env.exec("docker", args...) |
| 667 | cmd.Stdout = o.Stdout |
| 668 | cmd.Stderr = o.Stderr |
| 669 | return cmd.Run() |
| 670 | } |
| 671 | |
| 672 | func (e *DockerEnvironment) existDockerNetwork() (bool, error) { |
| 673 | out, err := e.exec("docker", "network", "ls", "--quiet", "--filter", fmt.Sprintf("name=%s", e.networkName)).CombinedOutput() |
nothing calls this directly
no test coverage detected