Why Your Docker Ubuntu Container Exits Immediately (and How to Fix It)🐳
dev.to·1d·
Discuss: DEV
Flag this post

f you’ve ever tried running an Ubuntu container on macOS (or any system) and noticed that it stops immediately, you’re not alone.

You might see something like this in Docker Desktop:

✅ Docker is running (green icon)

🧱 Image is downloaded

❌ Container won’t stay alive

Let’s break down why that happens — and how to fix it like a pro 💪


🧩 The Problem

You pull the image:

docker pull ubuntu

Then try to run it:

docker run ubuntu

But when you check:

docker ps -a

You see:

CONTAINER ID   IMAGE     COMMAND       STATUS                     PORTS   NAMES
123abc456def   ubuntu    "/bin/bash"   Exited (0) 3 seconds ago   ---     bold_blackburn

👉 It starts and exits immediately! You might wonder: “Why is my container not…

Similar Posts

Loading similar posts...