Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install docker on GitHub Actions

What is the official / recommended way to install Docker on GitHub Actions?

In particular I need to run a custom script on GitHub Actions that, among other tasks, calls docker build and docker push.

I don't want pre-made actions that build/push, I want to have access to the docker command.

What should I do?

The only official action that I can find uses Docker Buildx and not the normal docker: https://github.com/marketplace/actions/build-and-push-docker-images

Beside that I can find this action (https://github.com/marketplace/actions/setup-docker) but I don't know if I can trust that source, since it's not official.

Any recommendations? How do you install the docker command on GitHub Actions?

like image 874
collimarco Avatar asked Mar 16 '26 22:03

collimarco


1 Answers

Docker is already available in the default ubuntu images.

You can find all the installed software in actions/runner-images.

It looks like Windows and Mac images do not have the Docker client installed: Search results.

This is a valid CI that I use in my workflow:

name: Check that image builds
on:
  pull_request:

jobs:
  test-image:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Check that the image builds
        run: docker build . --file Dockerfile
like image 103
Javier Bullrich Avatar answered Mar 19 '26 17:03

Javier Bullrich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!