<!--

********************************************************************************

WARNING:

    DO NOT EDIT "swift/README.md"

    IT IS AUTO-GENERATED

    (from the other files in "swift/" combined with a set of templates)

********************************************************************************

-->

# Quick reference

-	**Maintained by**:  
	[the Swift Community](https://github.com/apple/swift-docker)

-	**Where to get help**:  
	[Swift Docker Community Forums](https://forums.swift.org/c/server/docker)

# Supported tags and respective `Dockerfile` links

-	[`5.2.5`, `5.2`, `5.2.5-bionic`, `5.2-bionic`, `bionic`, `latest`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/ubuntu/18.04/Dockerfile)
-	[`5.2.5-xenial`, `5.2-xenial`, `xenial`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/ubuntu/16.04/Dockerfile)
-	[`5.2.5-slim`, `5.2-slim`, `5.2.5-bionic-slim`, `5.2-bionic-slim`, `bionic-slim`, `slim`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/ubuntu/18.04/slim/Dockerfile)
-	[`5.2.5-xenial-slim`, `5.2-xenial-slim`, `xenial-slim`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/ubuntu/16.04/slim/Dockerfile)
-	[`5.2.5-focal-slim`, `5.2-focal-slim`, `focal-slim`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/ubuntu/20.04/slim/Dockerfile)
-	[`5.2.5-focal`, `5.2-focal`, `focal`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/ubuntu/20.04/Dockerfile)
-	[`5.2.5-amazonlinux2`, `5.2-amazonlinux2`, `amazonlinux2`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/amazonlinux/2/Dockerfile)
-	[`5.2.5-amazonlinux2-slim`, `5.2-amazonlinux2-slim`, `amazonlinux2-slim`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/amazonlinux/2/slim/Dockerfile)
-	[`5.2.5-centos8`, `5.2-centos8`, `centos8`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/centos/8/Dockerfile)
-	[`5.2.5-centos8-slim`, `5.2-centos8-slim`, `centos8-slim`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/centos/8/slim/Dockerfile)
-	[`5.2.5-centos7`, `5.2-centos7`, `centos7`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/centos/7/Dockerfile)
-	[`5.2.5-centos7-slim`, `5.2-centos7-slim`, `centos7-slim`](https://github.com/apple/swift-docker/blob/d58282b54afb6192de97d9cad973d2d2cc928dd5/5.2/centos/7/slim/Dockerfile)
-	[`5.1.5`, `5.1`, `5.1.5-bionic`, `5.1-bionic`](https://github.com/apple/swift-docker/blob/05538e13a3015675d83e2553cdce5d1d67e17235/5.1/ubuntu/18.04/Dockerfile)
-	[`5.1.5-xenial`, `5.1-xenial`](https://github.com/apple/swift-docker/blob/05538e13a3015675d83e2553cdce5d1d67e17235/5.1/ubuntu/16.04/Dockerfile)
-	[`5.1.5-slim`, `5.1-slim`, `5.1.5-bionic-sim`, `5.1-bionic-slim`](https://github.com/apple/swift-docker/blob/05538e13a3015675d83e2553cdce5d1d67e17235/5.1/ubuntu/18.04/slim/Dockerfile)
-	[`5.1.5-xenial-slim`, `5.1-xenial-slim`](https://github.com/apple/swift-docker/blob/05538e13a3015675d83e2553cdce5d1d67e17235/5.1/ubuntu/16.04/slim/Dockerfile)
-	[`5.0.3`, `5.0`, `5.0.3-bionic`, `5.0-bionic`](https://github.com/apple/swift-docker/blob/78d0a2dde09af579d06e2114a101fd90b01fbfb0/5.0/ubuntu/18.04/Dockerfile)
-	[`5.0.3-xenial`, `5.0-xenial`](https://github.com/apple/swift-docker/blob/78d0a2dde09af579d06e2114a101fd90b01fbfb0/5.0/ubuntu/16.04/Dockerfile)
-	[`5.0.3-slim`, `5.0-slim`, `5.0.3-bionic-slim`, `5.0-bionic-slim`](https://github.com/apple/swift-docker/blob/78d0a2dde09af579d06e2114a101fd90b01fbfb0/5.0/ubuntu/18.04/slim/Dockerfile)
-	[`5.0.3-xenial-slim`, `5.0-xenial-slim`](https://github.com/apple/swift-docker/blob/78d0a2dde09af579d06e2114a101fd90b01fbfb0/5.0/ubuntu/16.04/slim/Dockerfile)
-	[`4.2.4`, `4.2`, `4`](https://github.com/apple/swift-docker/blob/f0a61df2dd9a14dd6988e6017ae58cc63df37f41/4.2/ubuntu/16.04/Dockerfile)
-	[`4.1.3`, `4.1`](https://github.com/apple/swift-docker/blob/34aa283f9b3473ab22b2282f71773781b121af19/4.1/Dockerfile)
-	[`4.0.3`, `4.0`](https://github.com/apple/swift-docker/blob/34aa283f9b3473ab22b2282f71773781b121af19/4.0/Dockerfile)

# Quick reference (cont.)

-	**Where to file issues**:  
	[https://bugs.swift.org](https://bugs.swift.org) Component: Docker

-	**Supported architectures**: ([more info](https://github.com/docker-library/official-images#architectures-other-than-amd64))  
	[`amd64`](https://hub.docker.com/r/amd64/swift/)

-	**Published image artifact details**:  
	[repo-info repo's `repos/swift/` directory](https://github.com/docker-library/repo-info/blob/master/repos/swift) ([history](https://github.com/docker-library/repo-info/commits/master/repos/swift))  
	(image metadata, transfer size, etc)

-	**Image updates**:  
	[official-images PRs with label `library/swift`](https://github.com/docker-library/official-images/pulls?q=label%3Alibrary%2Fswift)  
	[official-images repo's `library/swift` file](https://github.com/docker-library/official-images/blob/master/library/swift) ([history](https://github.com/docker-library/official-images/commits/master/library/swift))

-	**Source of this description**:  
	[docs repo's `swift/` directory](https://github.com/docker-library/docs/tree/master/swift) ([history](https://github.com/docker-library/docs/commits/master/swift))

# What is Swift?

Swift is a high-performance system programming language. It has a clean and modern syntax, offers seamless access to existing C and Objective-C code and frameworks, and is memory safe by default.

Although inspired by Objective-C and many other languages, Swift is not itself a C-derived language. As a complete and independent language, Swift packages core features like flow control, data structures, and functions, with high-level constructs like objects, protocols, closures, and generics. Swift embraces modules, eliminating the need for headers and the code duplication they entail.

To learn more about the programming language, visit [swift.org](https://swift.org).

> [swift.org](https://swift.org/about/)  
> [Swift on Github](https://github.com/apple/swift)

![logo](https://raw.githubusercontent.com/docker-library/docs/0e2d9afd4e84369a43b810a5cfb5a131cfaac779/swift/logo.png)

# How to use this image

##### Start a REPL

Swift requires [a little bit of extra security privilege](https://github.com/apple/swift-docker/issues/9#issuecomment-272527182) to run the REPL. The following command creates an ephemeral container, attaches your terminal to it and starts the Swift REPL. A great way to try out pre-release builds!

```bash
docker run --cap-add sys_ptrace -it --rm swift swift
```

##### Pull the Docker Image From Docker Hub:

```bash
docker pull swift
```

##### Create a Container from the Image and Attach It:

```bash
docker run  -it --name swiftfun swift /bin/bash
```

##### To Start and Attach Your Image Later:

Start your image with name `swiftfun`

```bash
docker start swiftfun
```

and then attach it

```bash
docker attach swiftfun
```

# Image Variants

The `swift` images come in many flavors, each designed for a specific use case.

## `swift:<version>`

This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.

Some of these tags may have names like bionic, focal, or xenial in them. These are the suite code names for releases of [Ubuntu](https://wiki.ubuntu.com/Releases) and indicate which release the image is based on. If your image needs to install any additional packages beyond what comes with the image, you'll likely want to specify one of these explicitly to minimize breakage when there are new releases of Ubuntu.

## `swift:<version>-slim`

This image does not contain the common packages contained in the default tag and only contains the minimal packages needed to run `swift`. Unless you are working in an environment where *only* the `swift` image will be deployed and you have space constraints, we highly recommend using the default image of this repository.

# License

View [license information](https://swift.org/LICENSE.txt) for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

Some additional license information which was able to be auto-detected might be found in [the `repo-info` repository's `swift/` directory](https://github.com/docker-library/repo-info/tree/master/repos/swift).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
