{"id":13401398,"url":"https://github.com/lxc/ruby-lxc","last_synced_at":"2025-04-05T11:08:29.469Z","repository":{"id":12731984,"uuid":"15404899","full_name":"lxc/ruby-lxc","owner":"lxc","description":"ruby bindings for liblxc","archived":false,"fork":false,"pushed_at":"2023-07-24T15:07:37.000Z","size":180,"stargazers_count":133,"open_issues_count":9,"forks_count":29,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-03-23T13:01:54.751Z","etag":null,"topics":["containers","lxc","ruby"],"latest_commit_sha":null,"homepage":"https://linuxcontainers.org/lxc","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"xsf/xeps","license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lxc.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-23T21:22:04.000Z","updated_at":"2024-10-14T10:01:50.000Z","dependencies_parsed_at":"2024-06-19T02:54:15.545Z","dependency_job_id":"2559a676-dc0d-41cb-82fb-348f39cb2b1e","html_url":"https://github.com/lxc/ruby-lxc","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxc%2Fruby-lxc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxc%2Fruby-lxc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxc%2Fruby-lxc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxc%2Fruby-lxc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lxc","download_url":"https://codeload.github.com/lxc/ruby-lxc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"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":["containers","lxc","ruby"],"created_at":"2024-07-30T19:01:02.255Z","updated_at":"2025-04-05T11:08:29.420Z","avatar_url":"https://github.com/lxc.png","language":"C","funding_links":[],"categories":["Libraries","DevOps Tools"],"sub_categories":[],"readme":"# Ruby-LXC\n\n[![Build Status](https://travis-ci.org/lxc/ruby-lxc.svg?branch=master)](https://travis-ci.org/lxc/ruby-lxc)\n\n## Introduction\n\nRuby-LXC is a Ruby binding for liblxc. It allows the creation and management\nof Linux Containers from Ruby scripts.\n\n## Build and installation\n\nAssuming a current installation of LXC is available, to install Ruby-LXC\nsimply run the commands below\n\n```sh\nsudo apt-get install ruby-dev lxc-dev\n\nbundle install\nbundle exec rake compile\nbundle exec rake gem\ngem install pkg/ruby-lxc-1.2.0.gem\n```\nor just add this to your ```Gemfile```\n```ruby\ngem \"ruby-lxc\", github: \"lxc/ruby-lxc\", require: \"lxc\"\n```\n\n## Usage\n\n- Container lifecycle management (create, start, stop and destroy containers)\n```ruby\nrequire 'lxc'\nc = LXC::Container.new('foo')\nc.create('ubuntu') # create a container named foo with ubuntu template\nc.start\n# attach to a running container\nc.attach do\n  LXC.run_command('ifconfig eth0')\nend\nc.stop\nc.destroy\n```\n\n- Container inspection\n```ruby\nc.name\nc.config_path\nc.config_item('lxc.cap.drop')\nc.cgroup_item('memory.limit_in_bytes')\nc.init_pid\nc.interfaces\nc.ip_addresses\nc.state\n```\n\n- Additional state changing operations (freezing, unfreezing and cloning\ncontainers)\n```ruby\nc.freeze\nc.unfreeze\nc.reboot\nc.shutdown\n```\n\n- Clone a container\n```ruby\n# clone foo into bar. Parent container has to be frozen or stopped.\nclone = c.clone('bar')\n```\n\n- Wait for a state change\n```ruby\n# wait until container goes to STOPPED state, else timeout after 10 seconds\nc.wait(:stopped, 10)\n```\n\nCheck the provided rdoc documentation for a full list of methods. You can\ngenerate it running\n```sh\nrake rdoc\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxc%2Fruby-lxc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flxc%2Fruby-lxc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxc%2Fruby-lxc/lists"}