1

When one searches for make on dockerhub multiple images are returned, but none of them seems to be able to run make.

1
  • make by itself isn't really very useful, as it's only a task runner; are you perhaps looking for a container that is set up to compile C or C++ applications? Dec 2 '17 at 18:31
5

GNU make can be found in the gcc container.

Compile your app inside the Docker container There may be occasions where it is not appropriate to run your app inside a container. To compile, but not run your app inside the Docker instance, you can write something like:

$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp gcc:4.9 gcc -o myapp myapp.c

This will add your current directory, as a volume, to the container, set the working directory to the volume, and run the command gcc -o myapp myapp.c. This tells gcc to compile the code in myapp.c and output the executable to myapp. Alternatively, if you have a Makefile, you can instead run the make command inside your container

1

Depending on what language you want to build with, you can try some of these containers:

  • Python: lambci/lambda:build-python3.6
  • Nodejs: amaysim/serverless:1.23.0
  • Golang: amaysim/golang:1.8.3
-1

In my opinion there shouldn't be an image to run make, because if you want to build something from source you should install the dependencies and configure before run make, so I think it is just a command and you don't need an image to install it, even make is not a service to be in separate image, it must be used in Dockerfile to help you building your service from source during the image build time and not create a specific image for it.

2
  • I disagree, make within a container has plenty of valid use cases. A build container is a great way of having a consistent build environment across CI tools/environments without polluting your final image with build dependencies. Make is very useful as an entrypoint in that scenario. I agree that generally you will need some kind of dependencies/tools to utilise make, but perhaps there are some simple tasks where make can be useful by itself. Oct 24 '17 at 11:09
  • 3
    @user2640621 If you can find a valid use case of make without any third library header, then your build should not be impacted in any way by the make version. make itself doesn't bring much, you'll need to install the corresponding packages for libxxx-dev whatever the system is, and as such baking an image with just build-essential doesn't make much sense
    – Tensibai
    Oct 24 '17 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.