{"id":14069717,"url":"https://github.com/jmaxwilson/wsl-docker-git-setup","last_synced_at":"2025-07-30T06:32:31.466Z","repository":{"id":224202069,"uuid":"128144328","full_name":"jmaxwilson/wsl-docker-git-setup","owner":"jmaxwilson","description":"Shell script to configure Windows Subsystem for Linux (WSL) \u0026 Ubuntu on Windows to use docker and docker-compose as well as a git-enabled prompt","archived":false,"fork":false,"pushed_at":"2021-08-27T03:58:33.000Z","size":427,"stargazers_count":37,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-04T11:37:45.777Z","etag":null,"topics":["bash-on-windows","bash-prompt","bash-script","docker","docker-compose","docker-for-windows","git","ubuntu-on-windows","windows-10","windows-subsystem-linux","wsl"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmaxwilson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-04-05T01:19:11.000Z","updated_at":"2024-12-01T19:45:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e61b8e1-4d8c-45b3-a097-f81112b6eb3d","html_url":"https://github.com/jmaxwilson/wsl-docker-git-setup","commit_stats":null,"previous_names":["jmaxwilson/wsl-docker-git-setup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jmaxwilson/wsl-docker-git-setup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaxwilson%2Fwsl-docker-git-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaxwilson%2Fwsl-docker-git-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaxwilson%2Fwsl-docker-git-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaxwilson%2Fwsl-docker-git-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmaxwilson","download_url":"https://codeload.github.com/jmaxwilson/wsl-docker-git-setup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaxwilson%2Fwsl-docker-git-setup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267822668,"owners_count":24149666,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bash-on-windows","bash-prompt","bash-script","docker","docker-compose","docker-for-windows","git","ubuntu-on-windows","windows-10","windows-subsystem-linux","wsl"],"created_at":"2024-08-13T07:07:09.880Z","updated_at":"2025-07-30T06:32:30.993Z","avatar_url":"https://github.com/jmaxwilson.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# wsl-docker-git-setup\r\n\r\nThis is a shell script that can be run in the **Ubuntu for Windows Bash** running on the **Windows Subsystem for Linux (WSL)** to configure Bash for development using commandline **Docker** and **Git** commands on **Windows 10**. This makes it much easier to run most of the same docker scripts on Windows that you do on Linux or Mac by using WSL and Ubuntu Bash instead of GitBash and Git for Windows.\r\n\r\n## Prerequisits and Configuration\r\n\r\n- Windows 10 Professional\r\n- Windows Subsystem for Linux (WSL)\r\n- Docker for Windows\r\n\r\n### Installing the Windows Subsystem For Linux\r\n\r\nInstructions for installing the Windows Subsystem for Linux on Windows 10 and Ubuntu for Windows can be found at the official WSL website:\r\n \r\nhttps://msdn.microsoft.com/en-us/commandline/wsl/install_guide \r\n\r\n(The installation may require a system restart)\r\n\r\nOnce installation is complete, you should be able to start Ubuntu for Windows from the start menu. This project also includes an example shortcut for starting Ubuntu Bash.\r\n\r\n### Installing and Configuring Docker for Windows\r\n\r\nInstructions for installing Docker for Windows can be found at the official Docker website:\r\n\r\nhttps://store.docker.com/editions/community/docker-ce-desktop-windows\r\n\r\n(The installatiion may require a system restart to enable Hyper-V)\r\n\r\nOnce Docker for Windows has been installed, you will need to configure it so that it can be accessed from the WSL bash.\r\n\r\n- Right click the Docker Whale icon in system tray\r\n- Select \"Settings...\"\r\n- Under the \"General\" section\r\n  - Check the option to \"Expose daemon on tcp://localhost:2375 without TLS\"\r\n- Under the \"Shared Drives\" section\r\n  - Check the C Drive\r\n- Apply Changes (You may be prompted for your login credentials)\r\n\r\n## WSL Docker Git Setup Script\r\n\r\nGit comes installed by default with Ubuntu for Windows. You can clone this repository immediately from your WSL Bash by running:\r\n\r\n`git clone https://github.com/jmaxwilson/wsl-docker-git-setup.git`\r\n\r\nOnce the code has been cloned you can run `wsl-setup.sh` to configure your WSL Bash to be able to communicate with Docker for Windows and install a git-enabled commandline prompt that makes it easier to work with git from WSL.\r\n\r\n`cd wsl-docker-git-setup`\r\n\r\n`./wsl-setup.sh`\r\n\r\nThe interactive shell script:\r\n\r\n- Creates `.bashrc_wsl` file that is sourced from `.bashrc` for customizing the bash\r\n- Installs `docker-ce` and `docker-compose` and their dependencies for use on the commandline\r\n- Adds a `DOCKER_HOST` environment variable in `.bashrc_wsl` to allow docker to connect to Docker for Windows\r\n- Adds a symlink `/c` that points to the C drive shared by Docker for Windows (`/mnt/c`) so that docker paths will work properly\r\n- Adds a Git enabled prompt so that you can see Git branch information on the commandline\r\n- Sets the default directory when WSL Bash starts\r\n\r\nOnce the script has completed, you will need to exit bash and start it again for some of the changes to be applied.\r\n\r\nYou should be able to run `docker` and `docker-compose` commands from the WSL Ubuntu commandline on Windows as well as see git branch information in the command prompt.\r\n\r\nYou can test them by running:\r\n \r\n`docker info`\r\n\r\n`docker-compose version`\r\n\r\n`docker run hello-world`\r\n\r\nYou can now run most of the same docker scripts on Windows that you do on Linux or Mac by using WSL and Ubuntu Bash.\r\n\r\n![Animated GIF of Docker running in Ubuntu Bash running on Windows WSL](https://raw.githubusercontent.com/jmaxwilson/wsl-docker-git-setup/master/wsl-docker-git.gif \"Example Docker running in Ubuntu Bash running on Windows WSL\")\r\n\r\n## Additional Customization and Install Scripts\r\nThis project also includes some additional scripts that are not run by the `./wsl-setup.sh` script but that can be run individually for additional customization:\r\n\r\n`./create-aliases.sh`     - Creates aliases that override the default options for `ls` and `tree`\r\n\r\n`./dircolors.sh`          - Creates a `~/.dircolors` file that overrides the display colors of directories\r\n\r\n`./git-dir-install.sh`    - Creates a `git-dir` function to make it easy to run git commands on directories\r\n\r\n`./golang-install.sh`     - Installs [Go](https://golang.org) programming language support\r\n\r\n`./nodejs-install.sh`     - Installs [NodeJS](https://nodejs.org) programming language support\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmaxwilson%2Fwsl-docker-git-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmaxwilson%2Fwsl-docker-git-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmaxwilson%2Fwsl-docker-git-setup/lists"}