DEV Community

100x.crypto πŸš€πŸš€
100x.crypto πŸš€πŸš€

Posted on

Test installs in a clean Ubuntu sandbox

When you include installation guides in your tutorials or documentation, it's good practice to test the installation steps. But what if you already have the tool installed on your machine and don't want to uninstall it?

Here's a simple, elegant solution: use Docker to spin up a fresh Ubuntu environment in seconds, no changes to your existing setup required.

Note: This guide is written for Ubuntu. Windows and macOS are not covered here.

πŸ› οΈ Step 1: Install Docker (if not already installed)

Check whether docker is already installed on your system:

docker --version
Enter fullscreen mode Exit fullscreen mode

If docker is not yet installed on your Ubuntu system, install it with:

sudo apt update
sudo apt install docker.io -y
Enter fullscreen mode Exit fullscreen mode

Then start the Docker service:

sudo service docker start
Enter fullscreen mode Exit fullscreen mode

You can verify the installation:

docker --version
Enter fullscreen mode Exit fullscreen mode

You should see something like:

Docker version 26.1.3, build 26.1.3-0ubuntu1~20.04.1
Enter fullscreen mode Exit fullscreen mode

πŸ§ͺ Step 2: Launch a fresh Ubuntu container

Now spin up a fresh Ubuntu 22.04 container with:

docker run -it ubuntu:22.04 bash
Enter fullscreen mode Exit fullscreen mode

What this does:

  • docker run – creates and runs a container
  • -it – makes it interactive (so you can use it like a shell)
  • ubuntu:22.04 – pulls the official Ubuntu image from Docker Hub
  • bash – starts a Bash shell inside the container

πŸ‘‰ You're now inside a clean Ubuntu environment, just like a fresh server install.

πŸ§ͺ Step 3: Test installation steps

Let's test the installation of the curl tool.

Inside the container, try running:

curl --version
Enter fullscreen mode Exit fullscreen mode

You'll likely get:

bash: curl: command not found
Enter fullscreen mode Exit fullscreen mode

This is exactly what we want. Now you can follow your installation guide exactly as a new user would:

apt update
apt install curl -y
Enter fullscreen mode Exit fullscreen mode

Then verify again:

curl --version
Enter fullscreen mode Exit fullscreen mode

You should now see the installed version:

curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.2 ...
Enter fullscreen mode Exit fullscreen mode

🧹 Step 4: Exit and throw away the test environment

When you're done testing, simply type:

exit
Enter fullscreen mode Exit fullscreen mode

The container stops and disappears. Your real system remains unchanged, and you can spin up a new clean one anytime by running the same command:

docker run -it ubuntu:22.04 bash
Enter fullscreen mode Exit fullscreen mode

✨ Conclusion

Using Docker to simulate a clean Linux environment is one of the easiest ways to validate installation instructions without touching your real system. It’s quick, lightweight, and repeatable.

Note: I use ChatGPT to help me gather information and shape these posts, but I always test the commands myself and add my own insights to make them easier to understand. This blog is my personal record of what I learn as I go deeper into Linux. If it helps someone else too, even better!

Top comments (0)