{"id":17961352,"url":"https://github.com/xavriley/sonic-pi-docker","last_synced_at":"2025-03-25T03:31:40.087Z","repository":{"id":33731898,"uuid":"37386376","full_name":"xavriley/sonic-pi-docker","owner":"xavriley","description":"Sonic Pi Dockerized with Vagrant","archived":false,"fork":false,"pushed_at":"2017-12-07T15:23:37.000Z","size":22,"stargazers_count":31,"open_issues_count":2,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-19T08:42:00.419Z","etag":null,"topics":["audio","docker-container","linux","sonic-pi"],"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/xavriley.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}},"created_at":"2015-06-13T20:16:05.000Z","updated_at":"2024-04-18T03:34:43.000Z","dependencies_parsed_at":"2022-08-26T12:10:34.154Z","dependency_job_id":null,"html_url":"https://github.com/xavriley/sonic-pi-docker","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/xavriley%2Fsonic-pi-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavriley%2Fsonic-pi-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavriley%2Fsonic-pi-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavriley%2Fsonic-pi-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xavriley","download_url":"https://codeload.github.com/xavriley/sonic-pi-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245394752,"owners_count":20608122,"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":["audio","docker-container","linux","sonic-pi"],"created_at":"2024-10-29T11:09:06.867Z","updated_at":"2025-03-25T03:31:40.074Z","avatar_url":"https://github.com/xavriley.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Running Sonic Pi in Docker\n\nProbably only of interest to Sonic Pi developers or anyone looking to\nDockerize similar audio applications that used `jackd`.\n\n## Getting Started (OS X)\n\nThis uses Vagrant and VirtualBox so you'll need plenty of spare RAM and disk space.\n\n```\n# (cd into this dir)\n\nbrew tap caskroom/cask\nbrew cask install virtualbox\nbrew cask install vagrant\n```\n\nAlternatively install vagrant from [https://www.vagrantup.com/downloads.html](https://www.vagrantup.com/downloads.html)\n\nThen start a new terminal and run:\n\n```\nvagrant plugin install vagrant-docker-exec\nvagrant up\n```\n\nThe first time this will take something like 30 minutes as its\nbuilding a docker host with 40Gb of disk and 2Gb of RAM, and then\nproceeding to build the docker container for Sonic Pi\n\nTo run the GUI you have to ssh into the running Docker instance with X11 forwarding like so:\n\n```\nvagrant ssh -- -Y\n```\n\nIt will ask you for the password which is `sonicpi`\n\nOnce you're logged into the container, run the following to start the GUI:\n\n```\ndeveloper@97fc279e468b:~$ /usr/src/app/app/gui/qt/rp-app-bin\n```\n\nTo quit just ctrl+c the GUI process and log out of the SSH session with ctrl+d\n\nThen to stop the Docker container just run\n\n```\nvagrant halt\n```\n\nto rebuild from the Docker file (don't worry about the error)\n\n```\nvagrant reload; vagrant up\n```\n\nand to shut down the Docker host image (the big Ubuntu VM that's actually running docker)\n\n```\nVAGRANT_VAGRANTFILE=DockerHostVagrantfile vagrant halt\n```\n\n## Rationale\n\nWith Docker we have a way to run sandboxed\nSonic Pi code on a server for recording Gists in a sandbox and the like. It would also help\nin some development situations, mainly to test against a similar distro to Raspbian\nbut on a faster machine than the RPi.\n\n## Goals\n\n- [x] Make beeps using sonic\\_pi gem\n- [x] Run sshd server\n- [x] Run the GUI via X11 and ssh forwarding\n- [ ] Remove the `--privileged` flag so code is truly sandboxed\n\n## Related blog posts\n\nI had to do a lot of research just to figure out how to get Linux audio\nto work in VirtualBox in the way I wanted. In that sense I think this repo\nhas made some progress in that area and I can see useful approaches in here for\nother libraries that used `jackd` like SuperCollider or Overtone. With that in mind,\nheres a \"reading list\" of useful resources in Dockerizing audio applications in general.\n\n- [Running GUI apps with Docker](http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/)\n- [Docker containers on the Desktop](https://blog.jessfraz.com/post/docker-containers-on-the-desktop/)\n- [Docker Desktop](https://github.com/rogaha/docker-desktop)\n- [Running an SSH service on Docker](https://docs.docker.com/examples/running_ssh_service/)\n- [SuperCollider and jackd the easy way](http://carlocapocasa.com/supercollider-jack-the-easy-way/)\n- [Top 5 wrong ways to fix your (Linux) audio](http://voices.canonical.com/david.henningsson/2012/07/13/top-five-wrong-ways-to-fix-your-audio/)\n\n## Headless Sonic Pi\n\n```\nvagrant docker-exec -- sonic_pi \"play 70\"\n```\n\nFor something slightly more fun try\n\n```\nvagrant docker-exec -- sonic_pi \"$(wget -O - https://gist.githubusercontent.com/xavriley/ab0e7ad9b956c18af9f9/raw/68157657a9324e37fa8868a6137af6ace6952e30/wxg_piece.rb)\"\n# Listen to the output for a while\nvagrant docker-exec -- sonic_pi \"stop\"\n```\n\nNB with that last command it's actually the OSX host that's downloading the gist,\nnot the Docker container which is just being fed a string.\n\n## `boot2docker` won't work for this\n\nOSX and windows users can't use Docker directly. They need to run a virtual copy of\nlinux \\(a 'host' in docker terms\\) which then allows you to run the Docker containers\ninside that. The popular solution for this is called `boot2docker` and it's the one\nall the tutorials will point you to if you have a Mac or Windows machine.\n\nThe problem is that `boot2docker` runs a version of Linux that doesn't have any sound\ndrivers installed \\(It's a custom build of Tiny Core Linux for anyone who's curious...\\)\n\n\u003e \"No problem, I'll just `boot2docker ssh` and install the sound drivers using the package manager!\"\n\nErm, yeah about that... This version of Tiny Core Linux renames the\nkernel when building to `boot2docker-4.0.4` or similar. The package\nmanager in Tiny Core Linux happens to use the kernel name to figure out\nwhich packages to install - whether they need 32 or 64 bit - and the\nmain repo has no idea that boot2docker exists. That means you can't\nactually use the package manager for many things with `boot2docker`. On\ntop of that, any changes you made would get nuked on upgrade. That means\n`boot2docker` is a no-go until I can figure out how to do a build with\nsound support \\(which I've started on\n[here](https://github.com/xavriley/boot2docker)\\)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavriley%2Fsonic-pi-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxavriley%2Fsonic-pi-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavriley%2Fsonic-pi-docker/lists"}