{"id":21657296,"url":"https://github.com/zcubbs/go-containers","last_synced_at":"2026-05-21T07:35:20.368Z","repository":{"id":185996054,"uuid":"674448283","full_name":"zcubbs/go-containers","owner":"zcubbs","description":"This Go package provides a simple interface for running Docker containers directly from a host system.","archived":false,"fork":false,"pushed_at":"2023-08-04T02:24:20.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T11:48:28.803Z","etag":null,"topics":["docker","go"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/zcubbs/go-containers","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zcubbs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-04T01:32:05.000Z","updated_at":"2023-08-04T22:20:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd7a2b38-3791-49ad-a52a-a49f5a04294e","html_url":"https://github.com/zcubbs/go-containers","commit_stats":null,"previous_names":["zcubbs/go-containers"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcubbs%2Fgo-containers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcubbs%2Fgo-containers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcubbs%2Fgo-containers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcubbs%2Fgo-containers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zcubbs","download_url":"https://codeload.github.com/zcubbs/go-containers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554120,"owners_count":20471173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","go"],"created_at":"2024-11-25T09:20:38.427Z","updated_at":"2026-05-21T07:35:15.326Z","avatar_url":"https://github.com/zcubbs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-containers: Go Docker Containers package\n\n[![tag](https://img.shields.io/github/tag/zcubbs/go-containers)](https://github.com/zcubbs/go-containers/releases)\n![Go Version](https://img.shields.io/badge/Go-%3E%3D%201.20-%23007d9c)\n[![GoDoc](https://godoc.org/github.com/zcubbs/go-containers?status.svg)](https://pkg.go.dev/github.com/zcubbs/go-containers)\n![Build Status](https://github.com/zcubbs/go-containers/actions/workflows/test.yaml/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/zcubbs/go-containers)](https://goreportcard.com/report/github.com/zcubbs/go-containers)\n[![Coverage](https://img.shields.io/codecov/c/github/zcubbs/go-containers)](https://codecov.io/gh/zcubbs/go-containers)\n[![Contributors](https://img.shields.io/github/contributors/zcubbs/go-containers)](https://github.com/zcubbs/go-containers/graphs/contributors)\n[![License](https://img.shields.io/github/license/zcubbs/go-containers.svg)](./LICENSE)\n\nThis Go package provides a simple interface for running Docker containers directly from a host system.\n\n## Features\n\n- **Pull Docker Image**: The `RunContainerOnHost` function pulls a Docker image from a Docker registry.\n- **Create Docker Container**: The function creates a Docker container from the pulled image.\n- **Run Docker Container**: It then runs the Docker container on the host.\n- **Wait For Container To Complete**: The function waits for the Docker container to finish its execution.\n- **Fetch Logs**: It fetches and prints the logs of the Docker container to `os.Stdout`.\n\n## Dependencies\n\nThis package uses the following dependencies:\n\n- `context`: Standard Go package for carrying deadlines, cancellations signals, and other request-scoped values across API boundaries.\n- `github.com/docker/docker/api/types`: Docker API types.\n- `github.com/docker/docker/api/types/container`: Docker container types.\n- `github.com/docker/docker/client`: Docker client to interact with Docker API.\n- `io`: Standard Go package for basic interfaces to I/O primitives.\n- `os`: Standard Go package that provides a platform-independent interface to operating system functionality.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"github.com/zcubbs/gocontainers\"\n)\n\nfunc main() {\n\timage := \"ubuntu:latest\"\n\tcmd := []string{\"/bin/sh\", \"-c\", \"echo Hello, World\"}\n\n\terr := gocontainers.RunContainerOnHost(image, cmd)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzcubbs%2Fgo-containers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzcubbs%2Fgo-containers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzcubbs%2Fgo-containers/lists"}