{"id":19658219,"url":"https://github.com/cdaringe/run-container","last_synced_at":"2025-04-28T20:31:22.667Z","repository":{"id":37692583,"uuid":"162380128","full_name":"cdaringe/run-container","owner":"cdaringe","description":"run a docker container in nodejs, as concisely as possible :whale:","archived":false,"fork":false,"pushed_at":"2024-05-28T00:57:26.000Z","size":2047,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-28T10:39:58.146Z","etag":null,"topics":["container","docker","dockerode","node","run"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdaringe.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-19T03:54:27.000Z","updated_at":"2024-05-30T01:53:41.363Z","dependencies_parsed_at":"2024-05-30T01:53:09.695Z","dependency_job_id":null,"html_url":"https://github.com/cdaringe/run-container","commit_stats":{"total_commits":632,"total_committers":7,"mean_commits":90.28571428571429,"dds":"0.24208860759493667","last_synced_commit":"15c86fac0cbae27c9963b4bf3a30af07f9cc7563"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Frun-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Frun-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Frun-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Frun-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdaringe","download_url":"https://codeload.github.com/cdaringe/run-container/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224130035,"owners_count":17260741,"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":["container","docker","dockerode","node","run"],"created_at":"2024-11-11T15:36:33.988Z","updated_at":"2024-11-11T15:36:34.641Z","avatar_url":"https://github.com/cdaringe.png","language":"TypeScript","readme":"# run-container\n\nrun a docker container in nodejs\n\nruns a container using [dockerode](https://www.npmjs.com/package/dockerode), bootstrapping the pull \u0026 start processes, whilst also exposing a compact function to simplify docker's and dockerode's otherwise complex APIs\n\n[![TypeScript package](https://img.shields.io/badge/typings-included-blue.svg)](https://www.typescriptlang.org)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![CircleCI](https://circleci.com/gh/cdaringe/run-container.svg?style=svg)](https://circleci.com/gh/cdaringe/run-container)\n\n## usage\n\n```ts\nimport { run, runSimple } from \"run-container\";\n\n// runSimple, minimal example\nconst container = await runSimple({ image: \"postgres\" }); // =\u003e Dockerode.Container instance\nawait container.remove({ force: true });\n\n// runSimple, rich example\nawait runSimple({\n  autoRemove: true,\n  bindMounts: { \"/path/to/host/file.sh\": \"/path/to/container/file.sh\" },\n  cmd: [\"bash\", \"/path/to/container/file.sh\"],\n  env: { KEY: \"VALUE\" },\n  image: \"bash\",\n  name: \"script-fun\",\n  ports: { \"4000\": \"4000\" }, // tcp ports only. otherwise, use `run`\n});\nawait container.wait();\nawait container.remove();\n\n// run\n// exposes Dockerodes.ContainerCreateOptions full API,\n// which directly reflects the docker engine API!\n// https://docs.docker.com/engine/api/latest/\nconst container = await run({\n  Image: \"postgres\",\n  ExposedPorts: {\n    \"5432/tcp\": {},\n  },\n  HostConfig: {\n    AutoRemove: true,\n    PortBindings: { \"5432/tcp\": [{ HostPort: \"40000\" }] },\n  },\n});\n// ... do work\nawait container.remove({ force: true });\n```\n\nsee the [exported typescript typings in the docs folder](https://github.com/cdaringe/run-container/tree/master/docs), or check out the tiny source.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaringe%2Frun-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdaringe%2Frun-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaringe%2Frun-container/lists"}