Created
May 2, 2021 06:47
-
-
Save debdutdeb/eaabd2f6ae8c350efe1730b7b8c008fa to your computer and use it in GitHub Desktop.
Dockerfile and C program to demonstrate container pausing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest AS builder | |
WORKDIR / | |
COPY pause.c . | |
RUN apk add --no-cache gcc libc-dev && \ | |
gcc -o pause pause.c | |
FROM alpine:latest | |
WORKDIR / | |
COPY --from=builder /pause . | |
ENTRYPOINT [ "./pause" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
int main | |
(int argc, char ** argv, char ** envp) | |
{ | |
for (int i = 0; ; i++) { | |
printf("\rCount at %i", i); | |
fflush(stdout); | |
sleep(1); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment