The official musl docker image.
Maintained by: openEuler CloudNative SIG.
Where to get help: openEuler CloudNative SIG, openEuler.
Current musl docker images are built on the openEuler. This repository is free to use and exempted from per-user rate limits.
musl is an implementation of the C standard library built on top of the Linux system call API, including interfaces defined in the base language standard, POSIX, and widely agreed-upon extensions. musl is lightweight, fast, simple, free, and strives to be correct in the sense of standards-conformance and safety.
Learn more about musl on musl Website.
The tag of each musl docker image is consist of the version of musl and the version of basic image. The details are as follows
| Tag | Currently | Architectures |
|---|---|---|
| 1.2.6-oe2403sp4 | musl 1.2.6 on openEuler 24.03-LTS-SP4 | amd64, arm64 |
| 1.2.6-oe2403sp3 | musl 1.2.6 on openEuler 24.03-LTS-SP3 | amd64, arm64 |
| 1.2.5-oe2403sp1 | musl 1.2.5 on openEuler 24.03-LTS-SP1 | amd64, arm64 |
In this usage, users can select the corresponding {Tag} based on their requirements.
Pull the openeuler/musl image from docker
docker pull openeuler/musl:{Tag}
Run with an interactive shell
You can start the container with an interactive shell to run your own code using musl.
docker run -it --rm openeuler/musl:{Tag} bash
Write a Test Program (test.c)
Create a file named test.c with the following content:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
printf("Hello, musl! (PID: %d)\n", getpid());
// Test memory allocation (musl's malloc implementation)
int *arr = malloc(10 * sizeof(int));
if (!arr) {
perror("malloc failed");
return 1;
}
free(arr);
// Detect C library
#ifdef __GLIBC__
printf("C library: glibc\n");
#else
printf("C library: musl\n");
#endif
return 0;
}
Compilation Methods
Static Compilation
musl-gcc -static test.c -o static_app
./static_app
Output:
Hello, musl! (PID: 147)
C library: musl
If you have any questions or want to use some special features, please submit an issue or a pull request on openeuler-docker-images.
Content type
Image
Digest
sha256:fb129b2c5…
Size
173.9 MB
Last updated
2 months ago
docker pull openeuler/muslPulls:
1
Last week