When testing C compilers, installing risky Linux packages, or debugging cross-platform build scripts, spinning up an isolated, disposable Ubuntu container inside Docker takes seconds without dirtying your main host operating system.
Step 1: Launch Interactive Ubuntu Container (docker run -it)
# Download latest Ubuntu image and attach an interactive bash shell
docker run -it --name test_ubuntu ubuntu:24.04 bash
# Inside Ubuntu container shell prompt:
root@4c901f2a3e5b:/# cat /etc/os-release
# Output: Ubuntu 24.04 LTS (Noble Numbat)Step 2: Mount Host Directory & Persist Work
# Mount local host ~/workspace directory into /app inside container
docker run -it -v ~/workspace:/app ubuntu:24.04 bash
Comments and corrections