{"id":37197990,"url":"https://github.com/negativa-ai/blafs","last_synced_at":"2026-01-14T23:00:36.638Z","repository":{"id":278880279,"uuid":"936273056","full_name":"negativa-ai/BLAFS","owner":"negativa-ai","description":"A tool for Container Debloating that removes bloat and improves performance.","archived":false,"fork":false,"pushed_at":"2025-08-12T09:42:33.000Z","size":971,"stargazers_count":596,"open_issues_count":7,"forks_count":15,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-12T11:37:40.005Z","etag":null,"topics":["container","docker"],"latest_commit_sha":null,"homepage":"","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/negativa-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":"MAINTAINERS.md","copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-20T20:09:49.000Z","updated_at":"2025-08-12T09:42:37.000Z","dependencies_parsed_at":"2025-06-03T13:46:01.400Z","dependency_job_id":"48048e24-39b8-4f77-be83-6608a16061f2","html_url":"https://github.com/negativa-ai/BLAFS","commit_stats":null,"previous_names":["negativa-ai/blafs"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/negativa-ai/BLAFS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negativa-ai%2FBLAFS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negativa-ai%2FBLAFS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negativa-ai%2FBLAFS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negativa-ai%2FBLAFS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/negativa-ai","download_url":"https://codeload.github.com/negativa-ai/BLAFS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/negativa-ai%2FBLAFS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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"],"created_at":"2026-01-14T23:00:21.814Z","updated_at":"2026-01-14T23:00:36.392Z","avatar_url":"https://github.com/negativa-ai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BLAFS\n\n![example workflow](https://github.com/jzh18/BAFFS/actions/workflows/main.yml/badge.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nShrink you container size up to 95%.\n\n## Introduction\n\nBLAFS is a bloat-aware filesystem for container debloating.\nThe design principles of BLAFS are effective, efficient, and easy to use.\nIt detects the files used by the container, and then debloats the container by removing the unused files.\nThe debloated containers are still functional and can run the same workload as the original containers, but with a much smaller size and faster deployment.\n\nCheck the paper for more details: [The Cure is in the Cause: A Filesystem for Container Debloating](https://arxiv.org/abs/2305.04641).\n\n## Installation\n\nThe easiest way to install BAFFS is to use the Docker image:\n```\ndocker pull justinzhf/baffs:latest\n```\n\n## Quick Start\n\n1. Pull the BLAFS image:\n    ```\n    docker pull justinzhf/baffs:latest\n    ```\n2. Run the BLAFS container with privileged mode, so that we can run Docker in Docker:\n    ```\n    docker run  -d --name baffs --privileged=true  -v /tmp/docker:/var/lib/docker justinzhf/baffs:latest\n    ```\n    Note that we mount the host's `/tmp/docker` to the container's `/var/lib/docker`. \n    In this way, all the images pulled inside the container `baffs` will be stored in the host's `/tmp/docker`.\n    You can change the path to any other directory you like.\n3. Enter shell of the container:\n    ```\n    docker exec -it baffs bash\n    ``` \n4. Inside the container, we pull a redis image. We will debloat this image later.\n    ```\n    docker pull redis:7.4.1\n    ```\n5. Now we can start to debloat the redis image. \n    ```\n    baffs shadow --images=redis:7.4.1\n    ```\n    This will convert the filesystem of the redis image to BAFFS filesystem.\n6. Now we run the redis container with profiling workloads. It's recommended to run some extensive workloads, such as the unit tests/integration tests of your container. Here, for brevity, we simply start the redis server:\n    ```\n    docker run -it --rm redis:7.4.1\n    ```\n    After the redis server is started, use `Ctrl+C` to stop the redis server.\n8. At this step, BLAFS has detected all the files needed by the profiling workloads. We can now debloat the redis image:\n    ```\n    baffs debloat --images=redis:7.4.1\n    ```\n    This will generate a new redis image named `redis:7.4.1-baffs`, which has a much smaller size.\n\n9. Now let's compare the size of the redis image before and after debloating:\n    ```\n    docker images | grep redis\n    ```\n    Here is an example output:\n    ```\n    redis        7.4.1-baffs   d43e8b090126   4 months ago   28.8MB\n    redis        7.4.1         2724e40d4303   4 months ago   117MB\n    ```\n10. Finally, let's check whether the debloated image can still run the redis server:\n    ```\n    docker run -it --rm redis:7.4.1-baffs\n    ```\n    If the redis server can be started, then the debloating is successful!\n\n## Automating BLAFS \n\n\nBLAFS debloats a container in three steps:  \n\n1. **Convert** – Converts the container into the BLAFS filesystem.  \n2. **Profiling** – Runs profiling workloads to track file usage.  \n3. **Debloating** – Retains only the files used during profiling, removing everything else.  \n\nThis script provides an example of using BLAFS to debloat a Redis container: 🔗 [Example Script](https://github.com/negativa-ai/BLAFS/blob/main/tests/test.sh)\n* It first converts the container filesystem into BLAFS and uses some integration tests as the profiling workloads to debloat the redis container.\n* Next, it debloats the container according to the profiling workloads.\n* Finally, it runs the debloated container with the profiling workloads, to verify that the debloated one still function correctly.\n\n\n\n\n## Advanced Usage\n\nBLAFS has three working modes: no-sharing, sharing, and serverless. \nPlease refer to the paper for more details.\n\n### Set Logging Level\nSet logging level for `baffs`:\n```\nLOG_LEVEL=debug|info|warning|error baffs ...\n```\nSet logging level for `debloated_fs`:\n```\nSPDLOG_LEVEL=debug|info|warning|error baffs ...\n```\n\n### Debloat Multiple Images at Once\nIf two images share some common layers, we can debloat them together.\nAnd the debloated images will share the same layers.\n\n\n```\nbaffs shadow --images=img1,img2 # shadow multiple images, the two images should share the some layers initially\n# run the profiling workload for img1 and img2\nbaffs debloat --images=img1,img2 # this will debloat both img1 and img2, with shared layers\n```\n\n### Debloat Certain Layers of an Image\nServerless containers are usually built on top of a base image.\nWe can debloat the only the unique layers of the serverless container while keeping the base image untouched.\n\n```\nbaffs shadow --images=img1\n# run the profiling workload for img1\nbaffs debloat --images=img1 --top=3 # debloat img1 with top 3 layers\n```\n\n## Citation\nPlease cite our paper if you use BLAFS in your research:\n```\n@misc{zhang2025curecausefilesystemcontainer,\n      title={The Cure is in the Cause: A Filesystem for Container Debloating}, \n      author={Huaifeng Zhang and Philipp Leitner and Mohannad Alhanahnah and Ahmed Ali-Eldin},\n      year={2025},\n      eprint={2305.04641},\n      archivePrefix={arXiv},\n      primaryClass={cs.SE},\n      url={https://arxiv.org/abs/2305.04641}, \n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnegativa-ai%2Fblafs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnegativa-ai%2Fblafs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnegativa-ai%2Fblafs/lists"}