Probably because an update, but I don’t know why, my Makefiles cannot execute docker now.
Do you have any idea?
➤ cat Makefile
dock:
docker ps
php:
php -v
➤ make dock
docker ps
make: docker: Permission denied
make: *** [Makefile:2: dock] Error 127
➤ make php 2 ↵
php -v
PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
➤ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9c1ff6f5e0dc postgres:14.2-alpine "docker-entrypoint.s…" 9 days ago Up 4 minutes 0.0.0.0:5434->5432/tcp, :::5434->5432/tcp digital-docker-c-postgres-1
Thanks in advance
3
Answers
You probably have a directory name
docker
on your PATH. There’s a bug in the current versions of GNU make (actually, it’s a bug in gnulib) where it doesn’t skip subdirectories of directories on the PATH.You can either remove the
docker
subdirectory, or force make to invoke a shell to run your command, maybe like this:I recently encountered same issue as this, with the same permission denied error message while using docker and gmake with Golang.
In my case, the issue was caused by excluding the main package in my build command, thereby producing a binary that doesn’t have an entry point.
To elucidate, I had my directory like so:
cmd/app
andcmd/api.go
.api.go
contains my main function in the main package. My build command wasgo build -o tmp/bin/binary-name ./cmd/app*.go
, which will build the binary based on go files found only in app package. Then I got the error when attempting to run the produced binary file.I rectified by changing my build command to include the main package like so:
go build -o tmp/bin/binary-name ./cmd/*.go
For my Env: Ubuntu 22.10, GNU Make 4.3
I have
Makefile
:I use command
make test --debug
and have Error:Solution: You need downgrade GNU Make to 4.2 (more details)
sudo dpkg -i make*.deb
Total: