[GH-ISSUE #112] docker-compose: command not found #74

Closed
opened 2026-03-01 21:39:50 +03:00 by kerem · 21 comments
Owner

Originally created by @liemlylac on GitHub (Feb 28, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/112

Hi, this really nice repo for running action in locally.
But I have a problem when running docker-compose in action.

This is output

$ act -j test
[build/test] 🚀  Start image=node:12.6-buster-slim
[build/test]   🐳  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[build/test]   🐳  docker cp src=C:\Users\Liem\docker\wordpress-docker-compose/. dst=/github/workspace
[build/test] ⭐  Run actions/checkout@v2
[build/test]   ✅  Success - actions/checkout@v2
[build/test] ⭐  Run Build service s
[build/test]   | /github/workflow/1: line 2: docker-compose: command not found
[build/test]   ❌  Failure - Build service s
Error: exit with `FAILURE`: 127

This is my workflow config

name: build
on: 
  push:
    branches:
      - master
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build service s
        run: docker-compose up -d
      - name: List container
        run: docker-compose ps
      - name: Test Wordpress container
        run: docker run --rm --network container:wordpress-docker-compose_wordpress_1 appropriate/curl --retry 3 --retry-connrefused http://localhost:8080/
      - name: Test PhpMyAdmin container
        run: docker run --rm --network container:wordpress-docker-compose_phpmyadmin_1 appropriate/curl --retry 3 --retry-connrefused http://localhost:8888/

This is my docker-compose.yml file

version: '3.7'

services:
  wordpress:
    image: wordpress:latest
    depends_on:
      - wordpress_db
    ports:
      - "8080:80"
#    volumes:
#     - type: bind
#       source: ./wp-content
#       target: /var/www/html/wp-content
    restart: always
    environment:
      WORDPRESS_DB_HOST: wordpress_db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: secret
      WORDPRESS_DB_NAME: wordpress

  wordpress_db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: secret

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    depends_on:
      - wordpress_db
    restart: always
    ports:
      - "8888:80"
    environment:
      PMA_HOST: wordpress_db
      MYSQL_ROOT_PASSWORDL: secret
    networks:
      - back

networks:
  back:
volumes:
  db_data: {}

My PC:

  • Windows 10. version 1909
  • Docker version 19.03.5, build 633a0ea
Originally created by @liemlylac on GitHub (Feb 28, 2020). Original GitHub issue: https://github.com/nektos/act/issues/112 Hi, this really nice repo for running action in locally. But I have a problem when running docker-compose in action. This is output ```bash $ act -j test [build/test] 🚀 Start image=node:12.6-buster-slim [build/test] 🐳 docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [build/test] 🐳 docker cp src=C:\Users\Liem\docker\wordpress-docker-compose/. dst=/github/workspace [build/test] ⭐ Run actions/checkout@v2 [build/test] ✅ Success - actions/checkout@v2 [build/test] ⭐ Run Build service s [build/test] | /github/workflow/1: line 2: docker-compose: command not found [build/test] ❌ Failure - Build service s Error: exit with `FAILURE`: 127 ``` This is my workflow config ```yml name: build on: push: branches: - master jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Build service s run: docker-compose up -d - name: List container run: docker-compose ps - name: Test Wordpress container run: docker run --rm --network container:wordpress-docker-compose_wordpress_1 appropriate/curl --retry 3 --retry-connrefused http://localhost:8080/ - name: Test PhpMyAdmin container run: docker run --rm --network container:wordpress-docker-compose_phpmyadmin_1 appropriate/curl --retry 3 --retry-connrefused http://localhost:8888/ ``` This is my `docker-compose.yml` file ```yml version: '3.7' services: wordpress: image: wordpress:latest depends_on: - wordpress_db ports: - "8080:80" # volumes: # - type: bind # source: ./wp-content # target: /var/www/html/wp-content restart: always environment: WORDPRESS_DB_HOST: wordpress_db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: secret WORDPRESS_DB_NAME: wordpress wordpress_db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: secret MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: secret phpmyadmin: image: phpmyadmin/phpmyadmin depends_on: - wordpress_db restart: always ports: - "8888:80" environment: PMA_HOST: wordpress_db MYSQL_ROOT_PASSWORDL: secret networks: - back networks: back: volumes: db_data: {} ``` My PC: - Windows 10. version 1909 - Docker version 19.03.5, build 633a0ea
Author
Owner

@cplee commented on GitHub (Feb 28, 2020):

Related to #107

See https://github.com/nektos/act#runners.

You can customize the image used for the runs-on. I've created an image that is a match to GitHub runners, but its like 15GB!

<!-- gh-comment-id:592591822 --> @cplee commented on GitHub (Feb 28, 2020): Related to #107 See https://github.com/nektos/act#runners. You can customize the image used for the runs-on. I've created an image that is a match to GitHub runners, but its like 15GB!
Author
Owner

@cplee commented on GitHub (Mar 2, 2020):

Closing this as a duplicate of #107

<!-- gh-comment-id:593484884 --> @cplee commented on GitHub (Mar 2, 2020): Closing this as a duplicate of #107
Author
Owner

@kenorb commented on GitHub (May 14, 2020):

Related post: https://github.com/orgs/community/discussions/134407

<!-- gh-comment-id:628732312 --> @kenorb commented on GitHub (May 14, 2020): Related post: <https://github.com/orgs/community/discussions/134407>
Author
Owner

@swuecho commented on GitHub (Jul 23, 2020):

I create a image with docker and docker-compose.

docker pull echowuhao/act_base:latest

I think it is enough for those who use docker and docker-compose to run tests.

if not, easy to adjust based on the Dockerfile.

https://github.com/swuecho/act_base

<!-- gh-comment-id:662850643 --> @swuecho commented on GitHub (Jul 23, 2020): I create a image with docker and docker-compose. `docker pull echowuhao/act_base:latest` I think it is enough for those who use docker and docker-compose to run tests. if not, easy to adjust based on the Dockerfile. https://github.com/swuecho/act_base
Author
Owner

@lucasres commented on GitHub (Sep 11, 2020):

When i run with your image i have this erro

Error: Error response from daemon: pull access denied for echowuhao/act_base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
<!-- gh-comment-id:691133988 --> @lucasres commented on GitHub (Sep 11, 2020): When i run with your image i have this erro ``` Error: Error response from daemon: pull access denied for echowuhao/act_base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied ```
Author
Owner

@jadhavmanoj commented on GitHub (Oct 14, 2020):

same here. Any suggestion.

Error: Error response from daemon: pull access denied for echowuhao/act_base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

<!-- gh-comment-id:708378976 --> @jadhavmanoj commented on GitHub (Oct 14, 2020): same here. Any suggestion. `Error: Error response from daemon: pull access denied for echowuhao/act_base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied`
Author
Owner

@lucasres commented on GitHub (Oct 14, 2020):

The image is private :(

I tried the image nektos/act-environments-ubuntu:18.04. Docker and docker-composer work well but my container dont mount volume inside

<!-- gh-comment-id:708453479 --> @lucasres commented on GitHub (Oct 14, 2020): The image is private :( I tried the image nektos/act-environments-ubuntu:18.04. Docker and docker-composer work well but my container dont mount volume inside
Author
Owner

@LucasCtrl commented on GitHub (Nov 4, 2020):

I rebuild and republish the new image from @swuecho

docker pull lucasctrl/act_base:latest

https://github.com/lucasctrl/act_base

<!-- gh-comment-id:721944679 --> @LucasCtrl commented on GitHub (Nov 4, 2020): I rebuild and republish the new image from @swuecho `docker pull lucasctrl/act_base:latest` https://github.com/lucasctrl/act_base
Author
Owner

@hotlib commented on GitHub (Nov 16, 2020):

I rebuild and republish the new image from @swuecho

docker pull lucasctrl/act_base:latest

https://github.com/lucasctrl/act_base

I get the following error:

Error response from daemon: pull access denied for lucasctrl/act_base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

<!-- gh-comment-id:728035268 --> @hotlib commented on GitHub (Nov 16, 2020): > I rebuild and republish the new image from @swuecho > > `docker pull lucasctrl/act_base:latest` > > https://github.com/lucasctrl/act_base I get the following error: `Error response from daemon: pull access denied for lucasctrl/act_base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied`
Author
Owner

@LucasCtrl commented on GitHub (Nov 16, 2020):

Did you tried to be logged in before doing

docker pull lucasalt/act_base:latest

by using

docker login -u USERNAME -p PASSWORD

with your docker hub credentials?

<!-- gh-comment-id:728119399 --> @LucasCtrl commented on GitHub (Nov 16, 2020): Did you tried to be logged in before doing ``` docker pull lucasalt/act_base:latest ``` by using ``` docker login -u USERNAME -p PASSWORD ``` with your docker hub credentials?
Author
Owner

@hotlib commented on GitHub (Nov 16, 2020):

Did you tried to be logged in before doing

docker pull lucasalt/act_base:latest

by using

docker login -u USERNAME -p PASSWORD

with your docker hub credentials?

no, I thought I could download it without login - I somehow found another link to your image and that I could download without login (don’t remember the URL though) and it works great

<!-- gh-comment-id:728189256 --> @hotlib commented on GitHub (Nov 16, 2020): > Did you tried to be logged in before doing > > ``` > docker pull lucasalt/act_base:latest > ``` > > by using > > ``` > docker login -u USERNAME -p PASSWORD > ``` > > with your docker hub credentials? no, I thought I could download it without login - I somehow found another link to your image and that I could download without login (don’t remember the URL though) and it works great
Author
Owner

@swuecho commented on GitHub (Nov 17, 2020):

I did not know how I end up delete the image. thanks @LucasCtrl to set it up.

<!-- gh-comment-id:728691059 --> @swuecho commented on GitHub (Nov 17, 2020): I did not know how I end up delete the image. thanks @LucasCtrl to set it up.
Author
Owner

@visini commented on GitHub (Nov 17, 2020):

Using --platform ubuntu-latest=lucasalt/act_base:latest instead of --platform ubuntu-latest=lucasalt/act_base worked for me without docker login. Many thanks!

<!-- gh-comment-id:728718592 --> @visini commented on GitHub (Nov 17, 2020): Using `--platform ubuntu-latest=lucasalt/act_base:latest` instead of `--platform ubuntu-latest=lucasalt/act_base` worked for me without docker login. Many thanks!
Author
Owner

@hata6502 commented on GitHub (Mar 18, 2021):

https://docs.docker.jp/compose/install.html#linux-compose

It works GitHub Actions and act.

- run: sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
- run: sudo chmod +x /usr/local/bin/docker-compose
<!-- gh-comment-id:801999230 --> @hata6502 commented on GitHub (Mar 18, 2021): https://docs.docker.jp/compose/install.html#linux-compose It works GitHub Actions and act. ``` - run: sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose - run: sudo chmod +x /usr/local/bin/docker-compose ```
Author
Owner

@alexey2baranov commented on GitHub (Mar 21, 2021):

Another way is to create additional action setup-docker-compose like we have setup-node which is responsible for docker-compose installation

and this action can internally perform docker-compose --version to skip himself if docker-compose installed already. or it can internally check enverounment env=REAL_GITHUB_ACTION_IMAGE to skip himself.

I think it is more general way then create new image because it don't need to recreate image every time when base image changed.

<!-- gh-comment-id:803619401 --> @alexey2baranov commented on GitHub (Mar 21, 2021): Another way is to create additional action `setup-docker-compose` like we have `setup-node` which is responsible for docker-compose installation and this action can internally perform `docker-compose --version` to skip himself if docker-compose installed already. or it can internally check enverounment `env=REAL_GITHUB_ACTION_IMAGE` to skip himself. I think it is more general way then create new image because it don't need to recreate image every time when base image changed.
Author
Owner

@adrienjoly commented on GitHub (Dec 10, 2021):

On my Mac with M1 chip, I have to:

=> $ act --platform ubuntu-latest=lucasalt/act_base:latest --container-architecture linux/amd64

EDIT: Actually, my workflow relies on ubuntu-20.04 instead of ubuntu-latest, so I'm using:

$ act --platform ubuntu-20.04=lucasalt/act_base:latest --container-architecture linux/amd64
<!-- gh-comment-id:990886590 --> @adrienjoly commented on GitHub (Dec 10, 2021): On my Mac with M1 chip, I have to: - install docker-compose, as suggested by @hata6502, cf https://github.com/nektos/act/issues/112#issuecomment-801999230 - and specify the platform, as suggested by @visini, cf https://github.com/nektos/act/issues/112#issuecomment-728718592 - and use the `linux/amd64` architecture => `$ act --platform ubuntu-latest=lucasalt/act_base:latest --container-architecture linux/amd64` EDIT: Actually, my workflow relies on `ubuntu-20.04` instead of `ubuntu-latest`, so I'm using: ```sh $ act --platform ubuntu-20.04=lucasalt/act_base:latest --container-architecture linux/amd64 ```
Author
Owner

@adrienjoly commented on GitHub (Dec 12, 2021):

Medium images already contain docker-compose

I did pick the Medium image on first act run (see the image name below, as listed on https://github.com/nektos/act#runners), and got docker-compose: command not found anyway:

image

Here's the workflow file: https://github.com/openwhyd/openwhyd/blob/master/.github/workflows/ci.yml#L308

<!-- gh-comment-id:991870493 --> @adrienjoly commented on GitHub (Dec 12, 2021): > Medium images already contain `docker-compose` I did pick the Medium image on first `act` run (see the image name below, as listed on https://github.com/nektos/act#runners), and got `docker-compose: command not found` anyway: ![image](https://user-images.githubusercontent.com/531781/145708449-297553f7-8e0f-4737-ac13-1d9065832a5d.png) Here's the workflow file: https://github.com/openwhyd/openwhyd/blob/master/.github/workflows/ci.yml#L308
Author
Owner

@aucampia commented on GitHub (Feb 2, 2022):

is there any workaround for this?

<!-- gh-comment-id:1027907672 --> @aucampia commented on GitHub (Feb 2, 2022): is there any workaround for this?
Author
Owner

@topherfangio commented on GitHub (Feb 4, 2022):

Here's how I got it working.

First, make sure your Docker installation has enough space (I was maxed out at 60GB, so I doubled it to 120GB just to be safe.

Then, use Docker pull to grab the full image (15GB):

docker pull ghcr.io/catthehacker/ubuntu:full-latest

Now you can use this as your platform when starting act:

act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest -j my-job

One last note: I had to update my commands to use sudo so that it had enough permissions to run everything. Would love to know if there is a way to tell act to do this.

Here is an excerpt from my workflow:

name: Linting

on: [pull_request]

jobs:

  lint-api:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Create necessary files
        run: sudo touch .env.development.local

      - name: Start the container
        run: sudo docker-compose up --build -d api

      - name: Check Bundle
        run: sudo docker-compose exec -T api bundle install

      - name: Run rubocop
        run: sudo docker-compose exec -T api bundle exec rubocop

      - name: Dump docker logs on failure
        if: failure()
        uses: jwalton/gh-docker-logs@v1

Hope this helps someone in the future!

And shoutout to @catthehacker for his suggestion to run the docker pull command first 🙌 This allows you to see a progress bar of how the download and extraction is going.

<!-- gh-comment-id:1030050607 --> @topherfangio commented on GitHub (Feb 4, 2022): Here's how I got it working. First, make sure your Docker installation has enough space (I was maxed out at 60GB, so I doubled it to 120GB just to be safe. Then, use Docker pull to grab the full image (15GB): ```bash docker pull ghcr.io/catthehacker/ubuntu:full-latest ``` Now you can use this as your platform when starting act: ```bash act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest -j my-job ``` One last note: I had to update my commands to use `sudo` so that it had enough permissions to run everything. Would love to know if there is a way to tell act to do this. Here is an excerpt from my workflow: ```yml name: Linting on: [pull_request] jobs: lint-api: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Create necessary files run: sudo touch .env.development.local - name: Start the container run: sudo docker-compose up --build -d api - name: Check Bundle run: sudo docker-compose exec -T api bundle install - name: Run rubocop run: sudo docker-compose exec -T api bundle exec rubocop - name: Dump docker logs on failure if: failure() uses: jwalton/gh-docker-logs@v1 ``` Hope this helps someone in the future! And shoutout to @catthehacker for his suggestion to run the `docker pull` command first 🙌 This allows you to see a progress bar of how the download and extraction is going.
Author
Owner

@drewyangdev commented on GitHub (Feb 24, 2022):

Tried with the Large image act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest, but having permission denied while running actions/create-release@v1. #935 Comment

Since the Medium image act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest doesn't have permission denied issue, decided to extend the image by myself.

custom-medium.Dockerfile

# docker build -f custom-medium.Dockerfile -t drewyangdev/ubuntu:act-latest .
FROM ghcr.io/catthehacker/ubuntu:act-latest

RUN curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
    chmod +x /usr/local/bin/docker-compose && \
    ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose && \
    docker-compose --version

act -P ubuntu-latest=drewyangdev/ubuntu:full-latest

<!-- gh-comment-id:1050095687 --> @drewyangdev commented on GitHub (Feb 24, 2022): Tried with the Large image `act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest`, but having permission denied while running `actions/create-release@v1`. [#935 Comment](https://github.com/nektos/act/issues/935#issuecomment-1049971002) Since the Medium image `act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest` doesn't have permission denied issue, decided to extend the image by myself. [custom-medium.Dockerfile](https://gist.github.com/Yambottle/bb072fa3feee0916531ebc294fdb4900) ``` # docker build -f custom-medium.Dockerfile -t drewyangdev/ubuntu:act-latest . FROM ghcr.io/catthehacker/ubuntu:act-latest RUN curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \ chmod +x /usr/local/bin/docker-compose && \ ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose && \ docker-compose --version ``` `act -P ubuntu-latest=drewyangdev/ubuntu:full-latest`
Author
Owner

@sneko commented on GitHub (Jan 18, 2023):

I was about to use the runner image from @LucasCtrl but the latest version is from 2020 and it's hard to assume act did not bring improvements since then.

Except if there is a watcher for act images that rebuild one with docker-compose, I won't go this way.

The solution I use for now:

      - uses: KengoTODA/actions-setup-docker-compose@v1
        if: ${{ env.ACT }}
        name: Install `docker-compose` for local simulations
        with:
          version: '2.14.2'

(specify the version otherwise the action will require you providing a valid GITHUB_TOKEN)

<!-- gh-comment-id:1387307297 --> @sneko commented on GitHub (Jan 18, 2023): I was about to use the runner image from @LucasCtrl but the latest version is from 2020 and it's hard to assume `act` did not bring improvements since then. Except if there is a watcher for `act` images that rebuild one with `docker-compose`, I won't go this way. The solution I use for now: ```yaml - uses: KengoTODA/actions-setup-docker-compose@v1 if: ${{ env.ACT }} name: Install `docker-compose` for local simulations with: version: '2.14.2' ``` (specify the version otherwise the `action` will require you providing a valid `GITHUB_TOKEN`)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#74
No description provided.