{"id":16101517,"url":"https://github.com/mendhak/docker-spark-experimental","last_synced_at":"2026-03-18T17:56:09.022Z","repository":{"id":141194607,"uuid":"140625587","full_name":"mendhak/docker-spark-experimental","owner":"mendhak","description":"Experimental Spark master and worker with spark-shell and pyspark","archived":false,"fork":false,"pushed_at":"2018-07-11T21:36:25.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T06:38:47.440Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mendhak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-11T20:42:17.000Z","updated_at":"2023-09-08T17:42:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"088429cd-9e39-4256-8920-6d05f9ec865b","html_url":"https://github.com/mendhak/docker-spark-experimental","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendhak%2Fdocker-spark-experimental","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendhak%2Fdocker-spark-experimental/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendhak%2Fdocker-spark-experimental/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendhak%2Fdocker-spark-experimental/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mendhak","download_url":"https://codeload.github.com/mendhak/docker-spark-experimental/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419638,"owners_count":20936009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T18:50:11.616Z","updated_at":"2026-02-26T02:36:44.337Z","avatar_url":"https://github.com/mendhak.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Docker container with `spark-shell` and `pyspark` shell. Based on Ubuntu 16.04, with Spark 2.3.1 and Hadoop 2.7.\n\n\n### Prepare containers\n\nFirst rebuild the image\n\n    docker build -t spark .\n\nIn one terminal, start the master and worker\n\n    docker-compose up\n\nBrowse to the master: http://127.0.0.1:8080/   \nBrowse to the worker: http://127.0.0.1:8081/\n\n\n### Try spark-shell\n\nIn another terminal\n\n    docker-compose exec spark-master bash\n\n\nIn this master's bash, start a new spark shell and specify the master.\n\n    spark-shell --master spark://spark-master:7077\n\n\nTry this code sample to see it working\n\n    val NUM_SAMPLES = 100000000\n    val count = sc.parallelize(1 to NUM_SAMPLES).filter { _ =\u003e\n    val x = math.random\n    val y = math.random\n    x*x + y*y \u003c 1\n    }.count()\n    println(s\"Pi is roughly ${4.0 * count / NUM_SAMPLES}\")\n\nWhile it runs, watch it on the master's web page.\n\nExit the scala shell using `:quit`\n\n### Try pyspark\n\nIn the master's bash, start a new pyspark shell and specify the master. \n\n    pyspark --master spark://spark-master:7077\n\nTry this code sample to see it working\n\n    import random\n    num_samples = 100000000\n\n    def inside(p):     \n        x, y = random.random(), random.random()\n        return x*x + y*y \u003c 1\n\n    count = sc.parallelize(range(0, num_samples)).filter(inside).count()\n\n    pi = 4 * count / num_samples\n    print(pi)\n\n    sc.stop()\n\nWhile it runs, watch it on the master's web page.\n\nExit the pyspark shell using `quit()`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmendhak%2Fdocker-spark-experimental","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmendhak%2Fdocker-spark-experimental","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmendhak%2Fdocker-spark-experimental/lists"}