Commit d6044cb
Fix flaky docker compose teardown by force-disconnecting external containers (#21714)
## Summary & Motivation
Fixes a flaky docker compose teardown in integration tests (e.g.
`docker_dagster_cloud-docker_earliest_release`). The flake occurs when
`docker compose down` fails because external containers (like the
Buildkite agent container) are still connected to a compose-managed
network.
Two changes:
1. **New `_force_disconnect_external_containers` step before `docker
compose down`**: inspects the compose network, identifies containers not
managed by the compose file, and force-disconnects them. This ensures
`docker compose down` can cleanly remove its networks.
2. **`disconnect_container_from_network` now uses `--force`**: the
`--force` flag disconnects even if the container is in a
transient/stopping state.
## Test Plan
- This is a teardown-only change to test infrastructure; the fix
addresses a race condition that is only reproducible in CI (Buildkite
Docker environment).
- Verified the logic by reading the Docker CLI docs for `docker network
disconnect --force` and `docker network inspect`.
Internal-RevId: b6bd757f44362f85b1723d890706f393b60b28631 parent e71845f commit d6044cb
1 file changed
Lines changed: 54 additions & 4 deletions
Lines changed: 54 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
121 | 169 | | |
122 | 170 | | |
123 | 171 | | |
| |||
132 | 180 | | |
133 | 181 | | |
134 | 182 | | |
135 | | - | |
136 | | - | |
137 | 183 | | |
| 184 | + | |
138 | 185 | | |
139 | 186 | | |
140 | 187 | | |
141 | 188 | | |
142 | 189 | | |
143 | 190 | | |
144 | 191 | | |
145 | | - | |
| 192 | + | |
| 193 | + | |
146 | 194 | | |
147 | 195 | | |
148 | 196 | | |
| |||
190 | 238 | | |
191 | 239 | | |
192 | 240 | | |
193 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
194 | 244 | | |
195 | 245 | | |
196 | 246 | | |
| |||
0 commit comments