Skip to Content

5 Simple Docker Commands Every Self‑Hosting Beginner Should Know

Learn the five most important Docker commands to deploy, manage, and clean up containers safely on your home server.
27 January 2026 by
TechStora Editorial Board

1. Run a Container with docker run

Use docker run to start a new container from an image. Include ‑d for detached mode, ‑p to map ports, and ‑v for bind mounts. This command lets you quickly spin up services while keeping persistent data safe.

  • Command: docker run -d -p 8080:80 -v /mydata:/data myimagedetached execution, port mapping, bind mount, and image selection are all handled in one line.

2. List Running Containers with docker ps

Check which containers are active and which host ports are in use. This prevents port conflicts and helps you verify that your services are up.

  • Command: docker ps – shows container ID, image name, status, and port mappings.

3. Manage Persistent Storage with docker volume

Create and inspect volumes to keep data safe across container restarts. Volumes are the preferred method for databases and other stateful apps.

  • Command: docker volume create mydata – creates a named volume that can be attached with ‑v and remains after the container is removed.

4. Clean Up Unused Images with docker image prune

Free disk space by deleting dangling images that are no longer referenced. Regular pruning avoids storage bloat.

  • Command: docker image prune -f – forcefully removes untagged images, reclaiming disk space instantly.

5. Remove Unneeded Containers with docker rm

Delete stopped containers to keep the environment tidy. Remember that volumes persist unless you also remove them.

  • Command: docker rm mycontainer – safely removes the container while leaving its volume intact for future use.

Ready to boost your self‑hosting skills? Start using these Docker commands today!