https://github.com/yourbase/narwhal
Make managing Docker a little more friendly!
https://github.com/yourbase/narwhal
docker golang
Last synced: 3 months ago
JSON representation
Make managing Docker a little more friendly!
- Host: GitHub
- URL: https://github.com/yourbase/narwhal
- Owner: yourbase
- License: apache-2.0
- Created: 2019-10-31T19:53:14.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-02-25T21:51:57.000Z (over 5 years ago)
- Last Synced: 2024-06-21T06:42:04.586Z (about 2 years ago)
- Topics: docker, golang
- Language: Go
- Homepage:
- Size: 177 KB
- Stars: 6
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Narwhal!
[](https://pkg.go.dev/github.com/yourbase/narwhal?tab=doc)
Narwhal is a simplistic wrapper around the Docker Go API.
## Examples
For full examples and usage see [pkg.go.dev][examples].
```go
// Create a client
client := narwhal.DockerClient()
// Create a container
containerID, err := narwhal.CreateContainer(ctx, client, os.Stdout, narwhal.ContainerDefinition{
Image: "ubuntu:latest",
})
// Start a container
err := narwhal.StartContainer(ctx, client, containerID)
// Copy a file into a container
f, err := ioutil.TempFile("./", "tmpfile")
err = narwhal.UploadFile(ctx, client, containerID, "/tmp/tmpfile", f.Name())
// Execute a command in a container
err := narwhal.ExecShell(ctx, client, containerID, "echo 'Hello world!'", &narwhal.ExecShellOptions{})
```
[docs]: https://pkg.go.dev/github.com/yourbase/narwhal?tab=doc
[examples]: https://pkg.go.dev/github.com/yourbase/narwhal?tab=doc#pkg-examples