Docker
Make Command
Container Issues
Programming Troubleshooting
DevOps

make command not found in docker container

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

If a Docker container says make: command not found, the usual reason is simple: the image does not include make. Containers are often based on minimal images, so build tools that feel "standard" on a developer machine are intentionally absent unless you add them yourself.

Why make Is Missing

A container only contains what the image provides. Many slim or minimal base images omit tools such as make, compilers, package managers, and shells in order to keep the image small and reduce attack surface.

That means this can work on your laptop:

bash
make test

but fail inside the container with:

text
make: command not found

The fix is not to assume Docker is broken. The fix is to decide whether make truly belongs in that image.

Install make in the Image When You Need It

If the container really should run make, install it in the Dockerfile using the package manager that matches the base image.

For Debian or Ubuntu based images:

dockerfile
1FROM debian:bookworm-slim
2
3RUN apt-get update \
4    && apt-get install -y --no-install-recommends make \
5    && rm -rf /var/lib/apt/lists/*

For Alpine:

dockerfile
FROM alpine:3.20

RUN apk add --no-cache make

After rebuilding the image, the command becomes available to the container process.

Sometimes You Need More Than make

make is only an orchestration tool. It runs commands listed in a Makefile, and those commands may also require compilers, shells, language runtimes, or headers.

For example, a C build often needs more than just make:

dockerfile
1FROM debian:bookworm-slim
2
3RUN apt-get update \
4    && apt-get install -y --no-install-recommends build-essential \
5    && rm -rf /var/lib/apt/lists/*

If make becomes available but the build still fails, read the Makefile and identify the actual tools it invokes.

Use Multi-Stage Builds for Cleaner Runtime Images

A common best practice is to keep build tools out of the final runtime image. Install make and related tooling in a build stage, run the build, then copy only the artifacts into the runtime stage.

dockerfile
1FROM debian:bookworm-slim AS builder
2
3RUN apt-get update \
4    && apt-get install -y --no-install-recommends build-essential \
5    && rm -rf /var/lib/apt/lists/*
6
7WORKDIR /src
8COPY . .
9RUN make all
10
11FROM debian:bookworm-slim
12WORKDIR /app
13COPY --from=builder /src/bin/myapp /app/myapp
14
15CMD ["./myapp"]

This keeps the final image smaller and avoids shipping unnecessary build tools into production.

Check Which Image You Are Actually Running

Sometimes the Dockerfile looks correct but the running container still lacks make because you are using an old image or the wrong service definition.

Useful checks:

bash
docker images
docker ps
docker exec -it my-container sh

Inside the container, verify:

bash
which make
make --version
cat /etc/os-release

That quickly tells you whether the image was rebuilt and which package manager instructions should apply.

Ask Whether make Should Run Inside the Container at All

In some projects, make is just a convenience wrapper for developer workflows. The actual container entrypoint may not need it. For example, a local Makefile might only call docker compose build, docker compose up, or test commands from the host machine.

If the container's job is only to run the built application, installing make there may be unnecessary. The better solution may be:

  • run make on the host
  • use Docker only for the application runtime
  • keep build tooling in CI or a builder stage

That decision depends on the role of the container, not just on the missing command.

Common Pitfalls

The most common mistake is installing only make when the Makefile actually depends on compilers or other tools. Another is editing the Dockerfile but forgetting to rebuild the image, then debugging a stale container. Developers also sometimes install build tools directly into the final production image when a multi-stage build would keep the runtime image much cleaner.

Summary

  • 'make: command not found usually means the image does not include make.'
  • Install it with the package manager for the base image if the container truly needs it.
  • Remember that the Makefile may also need compilers or other build tools.
  • Prefer multi-stage builds when make is needed only during build time.
  • Verify you rebuilt and are actually running the updated image.

Course illustration
Course illustration

All Rights Reserved.