{"id":13416558,"url":"https://github.com/oracle/crashcart","last_synced_at":"2025-03-15T00:31:07.406Z","repository":{"id":66212418,"uuid":"95492492","full_name":"oracle/crashcart","owner":"oracle","description":"CrashCart: sideload binaries into a running container","archived":true,"fork":false,"pushed_at":"2018-08-15T20:33:30.000Z","size":54,"stargazers_count":269,"open_issues_count":3,"forks_count":19,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-07-31T21:57:11.547Z","etag":null,"topics":["containers","docker"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oracle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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}},"created_at":"2017-06-26T21:50:13.000Z","updated_at":"2024-04-26T13:10:16.000Z","dependencies_parsed_at":"2023-02-21T23:16:03.047Z","dependency_job_id":null,"html_url":"https://github.com/oracle/crashcart","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/oracle%2Fcrashcart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fcrashcart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fcrashcart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fcrashcart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oracle","download_url":"https://codeload.github.com/oracle/crashcart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243667716,"owners_count":20328032,"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","docker"],"created_at":"2024-07-30T21:01:00.863Z","updated_at":"2025-03-15T00:31:07.074Z","avatar_url":"https://github.com/oracle.png","language":"Rust","readme":"# `crashcart` - microcontainer debugging tool #\n\n![crashcart](https://github.com/oracle/crashcart/raw/master/crashcart.png\n\"crashcart\")\n\n## What is `crashcart`? ##\n\n`crashcart` is a simple command line utility that lets you sideload an image\nwith linux binaries into an existing container.\n\n## Building `crashcart` ##\n\n[![wercker status](https://app.wercker.com/status/3b1da922588f5550faca49a356013e52/s/master \"wercker status\")](https://app.wercker.com/project/byKey/3b1da922588f5550faca49a356013e52)\n\nInstall rust:\n\n    curl https://sh.rustup.rs -sSf | sh\n    rustup toolchain install stable-x86_64-unknown-linux-gnu\n    rustup default stable-x86_64-unknown-linux-gnu # for stable\n    rustup target install x86_64-unknown-linux-musl # for stable\n    rustup toolchain install nightly-x86_64-unknown-linux-gnu\n    rustup default nightly-x86_64-unknown-linux-gnu # for nightly\n    rustup target install x86_64-unknown-linux-musl # for nightly\n\nBuilding can be done via build.sh:\n\n    build.sh\n\nBy default, build.sh builds a dynamic binary using gnu. To build a static\nbinary, set `TARGET` to `x86_64-unknown-linux-musl`:\n\n    TARGET=x86_64-unknown-linux-musl ./build.sh\n\n## Building `crashcart.img` ##\n\nImage build dependencies:\n\n    sudo\n    docker\n\n`crashcart` will load binaries from an image file into a running container. To\nbuild the image, you just need docker installed and then you can use\nbuild_image.sh:\n\n    build_image.sh\n\nThe build image script will build a `crashcart_builder` image using the\ndockerfile in the builder directory. It will then run this builder as a\nprivileged container. It needs to be privileged because the image is created by\nloopback mounting an ext3 filesystem and copying files in. It may be possible\nto do this without root privileges using something like e2tools, but these have\nnot been packaged for alpine.\n\nThe `crashcart_builder` will take a very long time the first time it is run.\nThe relocated binaries are built from source via the nix package manager, and\nthe toolchain needs to be built from scratch. Later builds should go much more\nquickly because the nix store is cached in a in the vol directory and bind\nmounted into the builder.\n\nTo add to the list of packages in the resulting image, simply add the package\nnames to the packages file before building. Packages are installed via the\nnix-env tool. An up-to-date list of nix packages can be searched\n[here](https://nixos.org/nixos/packages.html).\n\n## Using `crashcart` ##\n\nTo enter a container and run `crashcart`'s bash just pass the container id:\n\n    sudo ./crashcart $ID\n\n$ID can be the container id of a `docker` or `rkt` container, or the pid of any\nprocess running inside a container.\n\nTo run another command from the `crashcart` image, pass the full path:\n\n    sudo ./crashcart $ID /dev/crashcart/bin/tcpdump\n\nTo use docker-exec instead of entering the namespaces via `crashcart`'s\ninternal namespace handling, use the -e flag (NOTE: that this requires $ID to be\na docker container id):\n\n    sudo ./crashcart -e $ID\n\n## Manually Running Binaries from the `crashcart` Image ##\n\nTo manually mount the `crashcart` image into a container, use the -m flag.\n\n    sudo ./crashcart -m $ID\n\nTo manually unmount the `crashcart` image from a container, use the -u flag.\n\n    sudo ./crashcart -u $ID\n\nOnce you have manually mounted the image, you can use `docker exec` or\n`nsenter` to run things inside the container.  `crashcart` locates its binaries\nin `/dev/crashcart/bin` or `/dev/crashcart/sbin`. To execute\n`tcpdump` for example, you can use:\n\n    docker exec -it $CONTAINER_ID /dev/crashcart/bin/tcpdump\n\nTo run a shell with the all of `crashcart`'s utilities available in the path, you\ncan use:\n\n    docker exec -it $CONTAINER_ID -- \\\n    /dev/crashcart/profile/bin/bash --rcfile /dev/crashcart/.crashcartrc -i\n\nYou can also do an equivalent command using `nsenter`:\n\n    sudo nsenter -m -u -i -n -p -t $PID -- \\\n    /dev/crashcart/profile/bin/bash --rcfile /dev/crashcart/.crashcartrc -i\n\nNote that if you are using user namespaces you might have to specify -U. You\nalso can use -S and -G to use a different user or group id in the container.\n\n`crashcart` leaves the image mounted as a loopback device. If there are no\ncontainers still using the `crashcart` image, you can remove the device as\nfollows:\n\n    sudo losetup -d `readlink crashcart.img.lnk`; sudo rm crashcart.img.lnk\n\n## Known Issues ##\n\n`crashcart` doesn't work with user namespaces prior to kernel 4.8. In earlier\nversions of the kernel, when you attempt to mount a device inside a mount\nnamespace that is a child of a user namespace, the kernel returns EPERM. The\nlogic was changed in 4.8 so that it is possible as long as the caller of mount\nis in the init userns.\n\n## TODO ##\n\n* add functionality to run image with crashcart mount using docker run -v\n* temporarily remount /dev in the container rw if it is ro\n* allow user to set uid and gid in the container\n\n## Contributing ##\n\n`crashcart` is an open source project. See [CONTRIBUTING](CONTRIBUTING.md) for\ndetails.\n\nOracle gratefully acknowledges the contributions to `crashcart` that have been made\nby the community.\n\n## Getting in touch ##\n\nThe best way to get in touch is Slack.\n\nClick [here](https://join.slack.com/t/oraclecontainertools/shared_invite/enQtMzIwNzg3NDIzMzE5LTIwMjZlODllMWRmNjMwZGM1NGNjMThlZjg3ZmU3NDY1ZWU5ZGJmZWFkOTBjNzk0ODIxNzQ2ODUyNThiNmE0MmI) to join the the [Oracle Container Tools workspace](https://oraclecontainertools.slack.com).\n\nThen join the [Crashcart channel](https://oraclecontainertools.slack.com/messages/C8CJ5M9ML).\n\n## License ##\n\nCopyright (c) 2017, Oracle and/or its affiliates. All rights reserved.\n\n`crashcart` is dual licensed under the Universal Permissive License 1.0 and the\nApache License 2.0.\n\nSee [LICENSE](LICENSE.txt) for more details.\n","funding_links":[],"categories":["Development with Docker","Diagnostics \u0026 Troubleshooting"],"sub_categories":["Development Environment"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle%2Fcrashcart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foracle%2Fcrashcart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle%2Fcrashcart/lists"}