DirectorySecurity advisories
Sign in

Directory

gcc-glibc logo

gcc-glibc

Last changed
Get started with latest for free
docker pull cgr.dev/chainguard/gcc-glibc

Need access to a specific version? Contact us.

Sign in for updates

Get notified of upcoming product changes, critical vulnerability notifications and patches and more.

Sign in
Versions
Overview
Provenance
Specifications
SBOM
Vulnerabilities
Advisories

Minimal container image for building C applications (which require glibc).

Download this Image

The image is available on cgr.dev:

docker pull cgr.dev/chainguard/gcc-glibc:latest

Usage

To build the C application in examples/hello/main.c:

$ docker run --rm -v "${PWD}:/work" cgr.dev/chainguard/gcc-glibc examples/hello/main.c -o hello

This will write a Linux binary to ./hello. If you're on Linux and have the glibc library, you should be able to run it directly. Otherwise you can run it in a container e.g:

$ docker run --rm -v "$PWD/hello:/hello" --platform linux/amd64 cgr.dev/chainguard/glibc-dynamic /hello
Hello World!

Note: only linux/amd64 is uspported at the moment.

We can also do this all in a multi-stage Dockerfile e.g:

FROM cgr.dev/chainguard/gcc-glibc as build

COPY hello.c /work/hello.c
RUN cc hello.c -o hello

FROM cgr.dev/chainguard/glibc-dynamic

COPY --from=build /work/hello /hello
CMD ["/hello"]

And we can also compile statically to be used in environments without glibc:

FROM cgr.dev/chainguard/gcc-glibc as build

COPY hello.c /work/hello.c
RUN cc --static hello.c -o hello

FROM cgr.dev/chainguard/static

COPY --from=build /work/hello /hello
CMD ["/hello"]
Licenses

Chainguard Images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" version of this image:

  • BSD-2-Clause

  • GCC-exception-3.1

  • GPL-2.0-only

  • GPL-2.0-or-later

  • GPL-3.0-or-later

  • ISC

  • LGPL-2.1-or-later

View more

For a complete list of licenses, please refer to this Image's SBOM.

Software license agreement

Category
application
languages

Products

Chainguard Images

© 2024 Chainguard, Inc.