When one searches for make on dockerhub multiple images are returned, but none of them seems to be able to run make.
3 Answers
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
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
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.
-
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 utilisemake
, but perhaps there are some simple tasks wheremake
can be useful by itself. Oct 24, 2017 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 justbuild-essential
doesn't make much sense– TensibaiOct 24, 2017 at 12:15
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?