How to Run Spark Locally with Docker! Spark 4.0 Cluster Setup for Beginners
A Spark 4.0 standalone cluster, one master and three workers, running on a laptop from a 29-line Docker Compose file. No cloud account, no local Java, no Spark install. Then the two ways it hangs and how to tell them apart. Spark 4.0 moved the Java baseline to 17, Scala to 2.13, and turned ANSI SQL mode on by default, which broke most of the older local-setup tutorials. This video builds the cluster the way it works now, runs a real PySpark job over 20 million rows across three workers, and then spends the back half on what goes wrong: the SPARK_NO_DAEMONIZE line that keeps your master alive, the file-not-found error that is really about a path only one container can see, and the most-searched Spark error there is, "Initial job has not accepted any resources", which has two unrelated causes that print the same message. You get a one-line grep that tells you which one you have, the driver-host fix for the networking case, the three numbers to read on the 4040 UI, and how Spark Connect removes the whole class of driver-address problems. ⏱️ Chapters 0:00 - A Spark cluster on a laptop in 12 seconds 1:02 - What changed in Spark 4.0: Java 17, Scala 2.13, ANSI 1:51 - Prerequisites: Docker only, no Java, no Spark 2:30 - The Compose file: master, ports 8080 vs 7077 2:57 - SPARK_NO_DAEMONIZE and why the master dies without it 3:22 - Workers with deploy replicas 3:40 - Checking the master log for registered workers 4:09 - Running a 20M-row PySpark job on the cluster 5:38 - Where your job file has to live: docker cp vs bind mount 6:09 - Data must be reachable from every worker 7:07 - The file-not-found error and the shared volume fix 8:27 - "Initial job has not accepted any resources" 9:16 - Cause 1: asking for more memory than a worker has 9:57 - Cause 2: same hang, right memory, networking 11:14 - One grep to tell them apart: count executor added 12:37 - Fixing the driver host and bind address 13:47 - Reading the Spark UI: task skew, shuffle, spill 15:24 - Why port 4040 disappears and the history server 16:05 - Spark Connect: moving the driver into the cluster 17:53 - Recap 🔗 Links Apache Spark: https://spark.apache.org Spark Connect: https://spark.apache.org/docs/latest/spark-connect-overview.html Docker: https://www.docker.com #ApacheSpark #Spark4 #Docker #DockerCompose #PySpark #dataengineering #sparktutorial #localspark #sparkcluster #sparkconnect #sparkstandalone #bigdata #distributedcomputing #sparkerrors #Java17