You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates docker_compose.md with:
- Async-only requirement prominently noted at top
- Minimal example section (like Java docs)
- Installation/requirements section
- Better service access examples showing full RawContainer API
- Lifecycle section with explicit down() vs auto-drop
- Build and pull configuration examples
- Clearer structure aligned with Java testcontainers docs
Key additions:
- Minimal redis example at the start
- Note that compose is tokio-only (no blocking support yet)
- Examples showing service() returns full container with exec/logs
- Explicit down() consuming self explained
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Testcontainers for Rust supports running multi-container applications defined in Docker Compose files. This is useful when your tests need multiple interconnected services or when you want to reuse existing docker-compose configurations from your development environment.
4
4
5
+
> **Note:** Docker Compose support is currently only available for async runtimes (tokio). Synchronous/blocking support may be added in a future release.
6
+
7
+
## Installation
8
+
9
+
Add the `docker-compose` feature to your dependencies:
10
+
11
+
```toml
12
+
[dev-dependencies]
13
+
testcontainers = { version = "0.25", features = ["docker-compose"] }
Use [`DockerCompose`](https://docs.rs/testcontainers/latest/testcontainers/compose/struct.DockerCompose.html) to start services defined in your compose files:
After calling `up()`, you can access individual services by name:
75
+
After calling `up()`, you can access individual services by name. The `service()` method returns a reference to the container, providing full access to the container API:
Docker Compose support is currently only available for async runtimes (tokio). If you need synchronous/blocking support, please open an issue on GitHub.
309
390
310
391
### Containerised Client Environment Variables
311
392
312
393
Environment variable support for the containerised client is not yet implemented. Use the local client if you need env vars.
313
394
314
-
## Feature Flag
395
+
## Requirements
315
396
316
-
Docker Compose support requires the `docker-compose` feature:
397
+
Docker Compose support requires:
317
398
318
-
```toml
319
-
[dependencies]
320
-
testcontainers = { version = "0.25", features = ["docker-compose"] }
321
-
```
399
+
1. **Feature flag:**
400
+
```toml
401
+
[dev-dependencies]
402
+
testcontainers = { version = "0.25", features = ["docker-compose"] }
403
+
```
404
+
405
+
2. **Async runtime:** Currently only tokio is supported
406
+
```toml
407
+
[dev-dependencies]
408
+
tokio = { version = "1", features = ["macros"] }
409
+
```
410
+
411
+
3. **Local Docker Compose CLI** (for local client mode):
412
+
```bash
413
+
docker compose version
414
+
# Docker Compose version v2.20.0 or later
415
+
```
416
+
417
+
Or use containerised client mode (no local installation needed)
0 commit comments