An os/exec like interface for running a command in a container, and being able to easily interact with stdin, stdout, and other adjustments

dockerexec

Go Reference Build & Test

An "os/exec" like interface for running a command in a container, and being able to easily interact with stdin, stdout, and other adjustments.

Usage

$ go get github.com/segevfiner/dockerexec

Example:

package main

import (
    "fmt"

    "github.com/docker/docker/client"
    "github.com/segevfiner/dockerexec"
)

func main() {
    // You might want to use client.WithVersion in production
    dockerClient, err := client.NewClientWithOpts(client.WithAPIVersionNegotiation(), client.FromEnv)
    if err != nil {
        panic(err)
    }

    cmd := dockerexec.Command(dockerClient, "ubuntu:focal", "sh", "-c", "echo Hello, World!")
	output, err := cmd.Output()
    if err != nil {
        panic(err)
    }

    fmt.Printf("%s", output)
}

License

BSD-3-Clause.

Similar Resources

Easily manage your work via command line

Wo Easily manage your work via command line Introduction Wo, is cli that provides it easy to manage your workspace. Wo provides to manipulating workfl

Dec 11, 2021

Command-line program to download videos from YouTube.com and other video sites

youtube-dl - download videos from youtube.com or other video platforms INSTALLATION DESCRIPTION OPTIONS CONFIGURATION OUTPUT TEMPLATE FORMAT SELECTION

Jan 9, 2023

Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

asciigraph Go package to make lightweight ASCII line graphs ╭┈╯. Installation go get github.com/guptarohit/asciigraph Usage Basic graph package main

Jan 8, 2023

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

Dec 31, 2022

oc CLI plugin to interact with Helm features provided by the OpenShift Console

OpenShift provides support for managing the lifecycle of Helm charts. This capability is limited primarily to the Web Console. This plugin enables the management of Helm charts similar to using the standalone Helm CLI while offloading much of the work to OpenShift.

Aug 20, 2022

I like reading news but I also like the terminal. I am leaning and practicing my go.

I like reading news but I also like the terminal. I am leaning and practicing my go.

I made an api and didn't know how to use it. Screenshots The initial screen when you first run the app. The screen after you specify an id. This app u

Jan 14, 2022

wy : a set of command-line tools to test your container-based platform

wy wy (Abbreviation of Would You) is a set of command-line tools to test your container-based platform. ToC: Commands Deployment Monitoring Contributi

Apr 30, 2022

Lux is a command-line interface for controlling and monitoring Govee lighting strips built in Go.

What is Lux? Lux is a command-line interface for controlling and monitoring Govee lighting strips built in Go. Lux provides it's users with the abilit

Dec 28, 2022

Inotify-tools is a C library and a set of command-line programs providing a simple interface to inotify.

inotify-tools This is a package of some commandline utilities relating to inotify. The general purpose of this package is to allow inotify's features

Jan 4, 2023
kcli: command line interface tool to interact with K8trics API server as well as manage its lifecycle
kcli: command line interface tool to interact with K8trics API server as well as manage its lifecycle

K8trics CLI (kcli) kcli is command line interface tool to interact with K8trics API server as well as manage its lifecycle. kcli can provision and dep

Dec 15, 2021
Top-like interface for container metrics
Top-like interface for container metrics

Top-like interface for container metrics ctop provides a concise and condensed overview of real-time metrics for multiple containers: as well as a sin

Jan 9, 2023
Podman-tui - A Terminal User Interface to interact with the podman (v3.x)
Podman-tui - A Terminal User Interface to interact with the podman (v3.x)

podman-tui podman-tui is a Terminal User Interface to interact with the podman (

Dec 23, 2022
yq lets you read YAML files easily on the terminal. You can find key/values easily
yq lets you read YAML files easily on the terminal. You can find key/values easily

yq yq lets you read YAML files easily on the terminal. You can find key/values easily. Motivation Reading yaml configurations for k8s file becomes ard

Nov 2, 2021
Simple Go-based setuid+setgid+setgroups+exec

gosu This is a simple tool grown out of the simple fact that su and sudo have very strange and often annoying TTY and signal-forwarding behavior. They

Jan 1, 2023
being a gh extension that runs animated terminal "screensavers"

gh-screensaver being a gh extension that runs animated terminal "screensavers" usage gh screensaver run a random screensaver gh screensaver -s pipes r

Nov 29, 2022
📈 A command-line utility to interact with TradingView

tvctl ?? A command-line utility to interact with TradingView. This utility aims to improve usability of tedius and repetative tasks, such as watchlist

Oct 18, 2022
A Go library and common interface for running local and remote commands

go-runcmd go-runcmd is a Go library and common interface for running local and remote commands providing the Runner interface which helps to abstract

Nov 25, 2021
Package command provide simple API to create modern command-line interface

Package command Package command provide simple API to create modern command-line interface, mainly for lightweight usage, inspired by cobra Usage pack

Jan 16, 2022
Hasura-fzf - This command has a fzf-like UI that allows you to find and run the file version used by the hasura command

hasura-fzf This command has a fzf-like UI that allows you to find and run the fi

Sep 29, 2022