Since you don’t need the image, just don’t push it. The build container is ephemeral and cleaned up automatically.
🧪 Alternative (not AWS-native)
If you're okay with EC2 or ECS, you could spin up a container instance, run docker build, and stream logs via SSM or CloudWatch — but CodeBuild is simpler and fully managed.
✅ Summary
Option
Best for
Captures stdout?
Needs image push?
CodeBuild
AWS-native
✅ Yes
❌ No
EC2 + SSM
Custom control
✅ Yes
❌ No
ECS Fargate
Overkill
❌ Not ideal
❌ No
Use CodeBuild — it's the cleanest AWS-native way to run docker build and just get the logs.