Files
setup-docker-action/README.md

142 lines
5.6 KiB
Markdown
Raw Normal View History

2023-09-13 09:15:19 +02:00
[![GitHub release](https://img.shields.io/github/release/docker/setup-docker-action.svg?style=flat-square)](https://github.com/docker/setup-docker-action/releases/latest)
2023-03-02 14:17:20 +01:00
[![GitHub marketplace](https://img.shields.io/badge/marketplace-docker--setup--docker-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/docker-setup-docker)
2023-09-13 09:15:19 +02:00
[![CI workflow](https://img.shields.io/github/actions/workflow/status/docker/setup-docker-action/ci.yml?branch=master&label=ci&logo=github&style=flat-square)](https://github.com/docker/setup-docker-action/actions?workflow=ci)
[![Test workflow](https://img.shields.io/github/actions/workflow/status/docker/setup-docker-action/test.yml?branch=master&label=test&logo=github&style=flat-square)](https://github.com/docker/setup-docker-action/actions?workflow=test)
[![Codecov](https://img.shields.io/codecov/c/github/docker/setup-docker-action?logo=codecov&style=flat-square)](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.
> [!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
![Screenshot](.github/setup-docker-action.png)
___
* [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-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:
```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
env:
2023-12-18 10:41:32 +01:00
LIMA_START_ARGS: --cpus 4 --memory 8
```
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) |
| `tcp-port` | Number | | TCP port to expose the Docker API locally |
2023-08-27 14:43:03 +02:00
| `context` | String | `setup-docker-action` | Docker context name. |
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
| `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 |
| `tcp` | String | Docker TCP address if tcp-port is set |
2024-02-29 16:20:43 +01:00
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.