2023-09-13 09:15:19 +02:00
[](https://github.com/docker/setup-docker-action/releases/latest)
2023-03-02 14:17:20 +01:00
[](https://github.com/marketplace/actions/docker-setup-docker)
2023-09-13 09:15:19 +02:00
[](https://github.com/docker/setup-docker-action/actions?workflow=ci)
[](https://github.com/docker/setup-docker-action/actions?workflow=test)
[](https://codecov.io/gh/docker/setup-docker-action)
2023-03-02 14:17:20 +01:00
## About
2023-03-10 01:58:55 +01:00
GitHub Action to set up (download and install) [Docker CE ](https://docs.docker.com/engine/ ).
Works on Linux, macOS and Windows.
2023-03-02 14:17:20 +01:00
2023-10-12 16:38:07 +02:00
> [!NOTE]
> This action is useful if you want to pin against a specific Docker version or
> set up a custom daemon configuration or if Docker is not available on your
> runner. If you're using [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources)
> on Linux or Windows, Docker is already up and running, so it might not be
> necessary to use this action.
2024-04-25 10:19:13 +02:00
> [!WARNING]
> Does not work on macOS runners with ARM architecture (no nested virtualization):
> * https://github.com/crazy-max/ghaction-setup-docker/pull/53
> * https://github.com/docker/actions-toolkit/issues/317
2023-03-02 14:17:20 +01:00

___
* [Usage ](#usage )
2023-08-27 14:43:03 +02:00
* [Quick start ](#quick-start )
* [Daemon configuration ](#daemon-configuration )
2023-12-18 10:41:32 +01:00
* [Define custom `limactl start` arguments (macOS) ](#define-custom-limactl-start-arguments-macos )
2023-03-02 14:17:20 +01:00
* [Customizing ](#customizing )
* [inputs ](#inputs )
2024-02-29 16:20:43 +01:00
* [outputs ](#outputs )
2023-03-02 14:17:20 +01:00
* [Contributing ](#contributing )
2023-03-10 11:17:01 +01:00
* [License ](#license )
2023-03-02 14:17:20 +01:00
## Usage
2023-08-27 14:43:03 +02:00
### Quick start
```yaml
name: ci
on:
push:
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up Docker
2024-12-06 14:44:50 +01:00
uses: docker/setup-docker-action@v4
2023-08-27 14:43:03 +02:00
```
### Daemon configuration
You can [configure the Docker daemon ](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file )
using the `daemon-config` input. In the following example, we configure the
Docker daemon to enable debug and the [containerd image store ](https://docs.docker.com/storage/containerd/ )
feature:
2023-03-02 14:17:20 +01:00
```yaml
name: ci
on:
push:
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up Docker
2024-12-06 14:44:50 +01:00
uses: docker/setup-docker-action@v4
2023-08-27 14:43:03 +02:00
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
2023-03-02 14:17:20 +01:00
```
2023-12-18 10:41:32 +01:00
### Define custom `limactl start` arguments (macOS)
2023-08-28 08:54:18 +02:00
2023-12-18 10:41:32 +01:00
You can define custom [`limactl start` arguments ](https://lima-vm.io/docs/reference/limactl_start/ )
using the `LIMA_START_ARGS` environment variable to customize the VM:
2023-08-28 08:54:18 +02:00
```yaml
name: ci
on:
push:
jobs:
docker:
runs-on: macos-latest
steps:
-
name: Set up Docker
2024-12-06 14:44:50 +01:00
uses: docker/setup-docker-action@v4
2023-08-28 08:54:18 +02:00
env:
2023-12-18 10:41:32 +01:00
LIMA_START_ARGS: --cpus 4 --memory 8
2023-08-28 08:54:18 +02:00
```
2023-03-02 14:17:20 +01:00
## Customizing
### inputs
2023-12-18 10:41:32 +01:00
The following inputs can be used as `step.with` keys
2023-03-02 14:17:20 +01:00
2023-08-27 14:43:03 +02:00
| Name | Type | Default | Description |
|-----------------|--------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------|
2023-09-10 15:43:27 +02:00
| `version` | String | `latest` | Docker CE version (e.g., `v24.0.6` ). |
2023-08-27 14:43:03 +02:00
| `channel` | String | `stable` | Docker CE [channel ](https://download.docker.com/linux/static/ ) (e.g, `stable` , `edge` or `test` ). |
| `daemon-config` | String | | [Docker daemon JSON configuration ](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file ) |
| `context` | String | `setup-docker-action` | Docker context name. |
2024-02-29 16:32:34 +01:00
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
2024-11-06 15:54:40 +01:00
| `rootless` | Bool | `false` | Start daemon in rootless mode |
2023-03-02 14:17:20 +01:00
2024-02-29 16:20:43 +01:00
### outputs
The following outputs are available
| Name | Type | Description |
|--------|--------|--------------------|
| `sock` | String | Docker socket path |
2023-03-02 14:17:20 +01:00
## Contributing
2023-09-13 09:15:19 +02:00
Want to contribute? Awesome! You can find information about contributing to
this project in the [CONTRIBUTING.md ](/.github/CONTRIBUTING.md )
2023-03-10 11:17:01 +01:00
## License
Apache-2.0. See `LICENSE` for more details.