Run Swift-lang Docker image on Windows 10 machine

  1. Install Docker Desktop on Windows 10 machine
  2. Get Swift docker image from swift.org
  3. Run docker image (instance a container) and “volume”(mount) Window 10 machine local folder c:\users\ee\swift_dev as /app folder in the docker container
docker run --privileged -v c:\users\ee\swfit_dev:/app -it --rm --name swift-latest swift:latest /bin/bash

4. Inside docker container run

mkdir hello
cd hello
swift package init --type executable
swift run

5. Now modify the source file in the local folder c:\users\ee\swift_dev on Windows 10 machine. Since the folder is mapped, you can now compile and run the latest code in docker container with Swift

swift run

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store