当然先安装docker。然后:
Docker Instructions
Pull the Docker Image From Docker Hub:

  1. docker pull swiftdocker/swift

Create a Container from the Image and Attach It:

  1. docker run --privileged -i -t --name swiftfun swiftdocker/swift:latest /bin/bash

To Start and Attach Your Image Later:
Start your image with name swiftfun

  1. docker start swiftfun

and then attach it

  1. docker attach swiftfun

enter swift container

  1. sudo docker exec -it swiftfun /bin/bash
  2. root@c40b22fed7a4:/# swift -v
  3. Swift version 3.0.2 (swift-3.0.2-RELEASE)
  4. Target: x86_64-unknown-linux-gnu
  5. /usr/bin/lldb "--repl=-target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics"
  6. Welcome to Swift version 3.0.2 (swift-3.0.2-RELEASE). Type :help for assistance.

参考: https://github.com/swiftdocker/docker-swift