Reputation: 25705
So I am experimenting with Docker and I am contemplating a possibility of compiling a source tree on my local machine, using gcc
& make
and some more dependent libraries from a Docker container running locally.
Is it even possible? If yes, how do I go about it?
Upvotes: 1
Views: 977
Reputation: 952
It's possible. There's an official gcc
image that does exactly that.
There's a couple of example Dockerfiles on their dockerhub page, that will help you get started:
FROM gcc:4.9
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
RUN gcc -o myapp main.c
CMD ["./myapp"]
Or, without building an image:
$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp gcc:4.9 gcc -o myapp myapp.c
Upvotes: 2