Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

GitHub releaseGitHub marketplaceCI workflowTest workflowCodecov

About

GitHub Action to set up (download and install) Docker CE. Works on Linux, macOS and Windows.

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 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):

Screenshot


Usage

Quick start

name: cion:
push:
jobs:
docker:
runs-on: ubuntu-lateststeps:
-
name: Set up Dockeruses: docker/setup-docker-action@v5

Daemon configuration

You can configure the Docker daemon using the daemon-config input. In the following example, we configure the Docker daemon to enable debug and the containerd image store feature:

name: cion:
push:
jobs:
docker:
runs-on: ubuntu-lateststeps:
-
name: Set up Dockeruses: docker/setup-docker-action@v5with:
daemon-config: | { "debug": true, "features": { "containerd-snapshotter": true } }

Define custom limactl start arguments (macOS)

You can define custom limactl start arguments using the LIMA_START_ARGS environment variable to customize the VM:

name: cion:
push:
jobs:
docker:
runs-on: macos-lateststeps:
-
name: Set up Dockeruses: docker/setup-docker-action@v5env:
LIMA_START_ARGS: --cpus 4 --memory 8

Customizing

inputs

The following inputs can be used as step.with keys

NameTypeDefaultDescription
versionStringlatestDocker version to use. See inputs.version.
channelStringstableDocker CE channel (stable or test). Only applicable to type=archive
daemon-configStringDocker daemon JSON configuration
tcp-portNumberTCP port to expose the Docker API locally
contextStringsetup-docker-actionDocker context name.
set-hostBoolfalseSet DOCKER_HOST environment variable to docker socket path.
rootlessBoolfalseStart daemon in rootless mode
runtime-basedirString<home>/setup-docker-actionDocker runtime base directory
github-tokenString${{ github.token }}Optional GitHub Token used to get releases and download assets to avoid rate limitation. On GitHub Enterprise, you might need to set a PAT for github.com.

inputs.version

By default, the latest stable version of Docker is fetched from download.docker.com.

You can specify a specific version number (e.g. v27.4.0). Which is a shorthand for the full comma separated value:

type=archive,channel=stable,version=v27.4.0

You can also use this full csv format instead.

Currently supported source types are:

  • archive
  • image

type=archive

KeyDefaultDescription
typearchiveThe source type of the Docker binaries. Possible values are archive and image.
channelstableThe download.docker.com channel (stable or test).
versionlatestThe Docker version to use.

Examples:

# last stable released versionversion: latestversion: type=archive # same as aboveversion: version=latest # same as aboveversion: type=archive,version=latest # same as above
# v27.3.0-rc.1 from test channelversion: type=archive,version=27.3.0-rc.1,channel=test

type=image

Other possible source type is image which will pull the Docker binaries from the moby/moby-bin and dockereng/cli-bin Docker Hub repositories. The advantage of using this source type is that these images are built by the Moby and Docker CI pipelines for each branch and PR, so you can use the tag input to install a specific version or branch (e.g. master).

KeyDefaultDescription
taglatestThe image tag to use.

See https://hub.docker.com/r/moby/moby-bin/tags and https://hub.docker.com/r/dockereng/cli-bin/tags for available tags.

Examples:

# install last stable released version from bin imagesversion: type=imageversion: type=image,tag=latest # same as above
# a cutting-edge version from the `master` branchversion: type=image,tag=master
# install v27.4.0 from bin imagesversion: type=image,tag=27.4.0

outputs

The following outputs are available

NameTypeDescription
sockStringDocker socket path
tcpStringDocker TCP address if tcp-port is set

Contributing

Want to contribute? Awesome! You can find information about contributing to this project in the CONTRIBUTING.md

License

Apache-2.0. See LICENSE for more details.

About

GitHub Action to set up (download and install) Docker CE

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

78 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages