-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_container.py
More file actions
36 lines (28 loc) · 998 Bytes
/
Copy pathstart_container.py
File metadata and controls
36 lines (28 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
import subprocess
import os
import time
def start_container():
"""Start the Docker container for analysis"""
# Change to sandbox directory
sandbox_dir = os.path.join(os.path.dirname(__file__), "sandbox")
os.chdir(sandbox_dir)
print("🐳 Starting Docker container...")
# Build and start container
subprocess.run(["docker-compose", "up", "-d", "--build"], check=True)
# Wait for container to be ready
print("⏳ Waiting for container to be ready...")
time.sleep(3)
# Verify container is running
result = subprocess.run(
["docker", "inspect", "-f", "{{.State.Running}}", "sandbox"],
capture_output=True, text=True
)
if result.stdout.strip() == "true":
print("✅ Container is running and ready for analysis!")
return True
else:
print("❌ Container failed to start properly")
return False
if __name__ == "__main__":
start_container()