Docker - Basics

🐳 Docker – Basics

Docker is a tool that makes it easy to run applications in isolated environments called containers. It’s lightweight, fast, and very useful when dealing with blockchain nodes, APIs, or backend tools.


🧠 What is Docker (In Simple Words)?

Think of Docker like a box.

  • You put an app and everything it needs inside this box.

  • You can send this box to any server.

  • It will run exactly the same way everywhere.

This is helpful because:

  • You don’t have to install dependencies manually.

  • It avoids "works on my machine" problems.

  • It saves time when setting up or migrating.


🧰 Why Use Docker in Crypto?

In the crypto world, Docker is commonly used to:

  • Run blockchain nodes (e.g. Ethereum, Cosmos, Aptos)

  • Host explorers, RPC servers, or tooling

  • Build reproducible environments for testnets


⚙️ How to Install Docker on Ubuntu (VPS)

For Ubuntu 20.04 or 22.04, run the following steps:

✅ Done! Docker is now installed and ready to use.

Optional: Add your user to the Docker group (to run docker without sudo):

Then log out and log back in, or run newgrp docker.


📦 Example: Running a Simple Container

Let’s try running an Ubuntu container:

This will:

  • Download the Ubuntu image (if not already downloaded)

  • Start an interactive shell inside the container

You can now run Linux commands inside this isolated environment.

To exit: just type exit


🧪 Example: Running a Blockchain Node with Docker

Here’s an example for running a Cosmos SDK chain node (e.g. Gaia):

You can also run full nodes with volume mounting and config, like:

This will:

  • Run the node in background (-d)

  • Mount your config directory

  • Expose the necessary ports


🗑️ Cleaning Up Docker

To see running containers:

To stop a container:

To remove a container:

To list all images:

To remove an image:


🧠 Summary

Term
Meaning

Container

A lightweight, isolated instance of an app

Image

The package used to create a container

Volume

A shared folder between your host and Docker

Docker Hub

Public repo of Docker images


💡 Docker is a must-have tool for DevOps and node runners. Once you get used to it, it’ll save you hours of setup time.

Next → Learn how to run your validator in Docker or monitor logs inside containers.

Last updated