{"id":17002137,"url":"https://github.com/bpetit/rs-docker-sync","last_synced_at":"2025-10-23T19:09:58.879Z","repository":{"id":43511583,"uuid":"366269689","full_name":"bpetit/rs-docker-sync","owner":"bpetit","description":"Minimalistic, synchronous, read-only client for local Docker socket.","archived":false,"fork":false,"pushed_at":"2022-09-13T10:44:21.000Z","size":176,"stargazers_count":2,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T01:27:24.745Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/bpetit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-11T05:49:43.000Z","updated_at":"2023-12-23T20:38:43.000Z","dependencies_parsed_at":"2022-09-02T16:35:55.956Z","dependency_job_id":null,"html_url":"https://github.com/bpetit/rs-docker-sync","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetit%2Frs-docker-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetit%2Frs-docker-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetit%2Frs-docker-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpetit%2Frs-docker-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpetit","download_url":"https://codeload.github.com/bpetit/rs-docker-sync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248130154,"owners_count":21052707,"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":[],"created_at":"2024-10-14T04:27:08.300Z","updated_at":"2025-10-23T19:09:58.798Z","avatar_url":"https://github.com/bpetit.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":" This is a fork\n\nThis is a fork of [https://gitlab.com/kblobr/rust-docker](https://gitlab.com/kblobr/rust-docker) ([rs-docker](https://crates.io/crates/rs-docker) on crate.io) which itself is a fork from [https://github.com/ghmlee/rust-docker](https://github.com/ghmlee/rust-docker) ([docker](https://crates.io/crates/docker) on crates.io). Both repositories seemed to be no longer be maintained. The main reason for this fork, besides the maintainance, is that [Scaphandre](https://github.com/hubblo-org/scaphandre/) needed a synchronous library to talk to Docker socket.\n\nIssues and PRs welcome.\n\n# Docker\n\nMinimalistic, synchronous, read-only client for local Docker socket.\n\nDocumentation is available [here](https://docs.rs/docker-sync).\n\n## Quick start\n\n```\n[dependencies]\ndocker-sync = \"0.1.2\"\n```\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let docker = match Docker::connect() { // we consider the local Docker socket by default, with the default path (/var/run/docker.sock), no need to precise the path\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n## Requirements\n\n* Rust (\u003e= v1.4.0)\n* Docker (\u003e= v1.5.0)\n\n## Examples\n\n### Networks\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let networks = match docker.get_networks() {\n        Ok(networks) =\u003e networks,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n\n### Containers\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let containers = match docker.get_containers(false) {\n        Ok(containers) =\u003e containers,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n### Stats\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let containers = match docker.get_containers(false) {\n        Ok(containers) =\u003e containers,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let stats = match docker.get_stats(\u0026containers[0]) {\n        Ok(stats) =\u003e stats,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n### Images\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let images = match docker.get_images(false) {\n        Ok(images) =\u003e images,\n        Err(e) =\u003e { panic!({}, e); }\n    };\n}\n\n```\n\n### Info\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let info = match docker.get_system_info() {\n        Ok(info) =\u003e info,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n### Processes\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let containers = match docker.get_containers(false) {\n        Ok(containers) =\u003e containers,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let processes = match docker.get_processes(\u0026containers[0]) {\n        Ok(processes) =\u003e processes,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n### Filesystem changes\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let containers = match docker.get_containers(false) {\n        Ok(containers) =\u003e containers,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let changes = match docker.get_filesystem_changes(\u0026containers[0]) {\n        Ok(changes) =\u003e changes,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n### Export a container\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let containers = match docker.get_containers(false) {\n        Ok(containers) =\u003e containers,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let bytes = match docker.export_container(\u0026containers[0]) {\n        Ok(bytes) =\u003e bytes,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n### Ping the docker server\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let ping = match docker.ping() {\n        Ok(ping) =\u003e ping,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n}\n```\n\n### Show the docker version information\n\n```rust\nextern crate docker_sync;\n\nuse docker_sync::Docker;\n\nfn main() {\n    let mut docker = match Docker::connect() {\n    \tOk(docker) =\u003e docker,\n        Err(e) =\u003e { panic!(\"{}\", e); }\n    };\n\n    let version = match docker.get_version() {\n        Ok(version) =\u003e version,\n        Err(e) =\u003e {panic!(\"{}\",e)}\n    };\n}\n```\n\n## Contributing\n\nTo have a consistent dev environment one can use the docker image in /devenv like so:\n1. `git clone https://github.com/bpetit/rs-docker-sync`\n2. `cd rust-docker/devenv`\n3. `./build_docker` (this assumes your user can run docker commands, otherwise `sudo`)\n4. `./run_docker -ti`\n5. Already inside the container:\n  1. `cd Code`\n  2. `cargo test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpetit%2Frs-docker-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpetit%2Frs-docker-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpetit%2Frs-docker-sync/lists"}