{"id":13437180,"url":"https://github.com/ottomatica/slim","last_synced_at":"2025-05-15T15:07:19.287Z","repository":{"id":39917464,"uuid":"178554377","full_name":"ottomatica/slim","owner":"ottomatica","description":"Build and run tiny vms from Dockerfiles. Small and sleek.","archived":false,"fork":false,"pushed_at":"2023-03-06T16:56:39.000Z","size":6663,"stargazers_count":2108,"open_issues_count":11,"forks_count":53,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-07T20:11:15.640Z","etag":null,"topics":["docker","micro-vm","virtualization"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ottomatica.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}},"created_at":"2019-03-30T12:13:56.000Z","updated_at":"2025-03-12T10:47:35.000Z","dependencies_parsed_at":"2024-01-06T01:55:03.146Z","dependency_job_id":"5f6602ff-edeb-41b4-b57c-385047396af5","html_url":"https://github.com/ottomatica/slim","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ottomatica%2Fslim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ottomatica%2Fslim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ottomatica%2Fslim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ottomatica%2Fslim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ottomatica","download_url":"https://codeload.github.com/ottomatica/slim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364270,"owners_count":22058878,"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","micro-vm","virtualization"],"created_at":"2024-07-31T03:00:54.854Z","updated_at":"2025-05-15T15:07:14.263Z","avatar_url":"https://github.com/ottomatica.png","language":"JavaScript","readme":"# slim | ![CI](https://github.com/ottomatica/slim/workflows/CI/badge.svg)\n\n`slim` will build a VM from a Dockerfile. Slim works by building and extracting a rootfs from a Dockerfile, and packaging a corresponding kernel and initrd into a desired image.\n\nThis results in a real VM that can boot instantly, while using very limited resources---all with a couple of lines in a Dockerfile.\n\n## Using slim\n\nThe following are a few ways you can use slim to build VM images.\n\n### Build a Ubuntu Focal Cloud Raw VM Image\n\n1. Provide a Dockerfile `images/ubuntu-20.04-cloud-init`\n\n```Dockerfile\nFROM ubuntu:20.04 AS kernel\nRUN apt-get update \u0026\u0026 \\\n    apt-get install -y linux-virtual \u0026\u0026 \\\n    apt-get clean\n\nFROM ubuntu:20.04\n\n# Extract the kernel, modules, and initrd\nCOPY --from=kernel /lib/modules /lib/modules\nCOPY --from=kernel /boot/vmlinuz-* /vmlinuz\nCOPY --from=kernel /boot/initrd.img-* /initrd\n\nRUN apt-get update \n# Needed for configuring server and setting up devices.\nRUN apt install cloud-init udev kmod -y\n# If you'd like to be able to ssh in:\nRUN apt install openssh-server sudo -y\n```\n\n2. Extract an initrd, rootfs, and uncompressed kernel.\n\n```\n$ slim build images/ubuntu-20.04-cloud-init\n...\n$ ls -lh ~/.slim/registry/ubuntu-20.04-cloud-init\n-rw-r--r--  1 cjparnin  staff    16M Jan  2 17:37 initrd\n-rw-r--r--  1 cjparnin  staff   512M Jan  2 19:24 rootfs\n-rw-------@ 1 cjparnin  staff    29M Nov  5 12:04 vmlinuz\n```\n\n3. Provide a user-data and meta-data file to customize VM.\n\n```\n$ slim cloudinit images/ubuntu-20.04-cloud-init\n...\n$ ls -lh ~/.slim/registry/ubuntu-20.04-cloud-init\n-rw-r--r--  1 cjparnin  staff   366K Jan  2 21:19 cidata.iso\n```\n\nVM Running in MAC M1 (arm64).\n![slim in macos](doc/img/macos.png)\n\n### Create a custom Alpine RAM only VM Image\n\n1. Provide a Dockerfile and custom init script.\n\nSee [images/alpine3.12-raw](images/alpine3.12-raw).\n\n2. Build initrd and kernel.\n\n```bash\n$ slim build images/alpine3.12-raw -f initrd\n...\n$ ls -lh ~/.slim/registry/alpine3.12-raw         \n-rw-r--r--  1 cjparnin  staff    22M Jan  2 20:50 initrd\n-rw-r--r--  1 cjparnin  staff   4.6M Dec 28 11:22 vmlinuz\n```\n\n### Create a Hyper-V VHD Image (Windows)\n\nThe following creates a Ubuntu Focal with cloud-init, but the necessary hyper-v kernel modules,\nand bootable image for Microsoft's Hyper-V.\n\n1. Provide a Dockerfile.\n\nSee [images/ubuntu-20.04-ci-hyperv](images/ubuntu-20.04-ci-hyperv).\n\n2. Create a VHD disk drive (1G) with EFI bootable partition.\n\n```\nPS slim build images/ubuntu-20.04-ci-hyperv -f vhd -s 1024\n...\nPS ls ~/.slim/registry/ubuntu-20.04-ci-hyperv\n-a----          1/2/2022   3:19 PM      738381824 rootfs.vhd\n```\n\n3. Provide a user-data and meta-data file to customize VM.\n\n```\n$ slim cloudinit images/ubuntu-20.04-ci-hyperv\n...\n$ ls -lh ~/.slim/registry/ubuntu-20.04-ci-hyperv\n-a----          1/1/2022   3:32 PM         374784 cidata.iso\n```\n\n![slim in hyperv](doc/img/slim-hyperv.png)\n\n## Installing slim\n\nSimply clone this repo, cd slim, and run:\n\n```\nnpm install\nnpm link\n\n# Pull docker images used for system dependencies.\nslim init\n```\n\nYou must have [docker](https://docs.docker.com/install/) on your system.","funding_links":[],"categories":["JavaScript","docker","Tools","Virtualization"],"sub_categories":["Node","Containers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fottomatica%2Fslim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fottomatica%2Fslim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fottomatica%2Fslim/lists"}