Skip to content

Instantly share code, notes, and snippets.

@debdutdeb
Created May 2, 2021 06:47
Show Gist options
  • Save debdutdeb/eaabd2f6ae8c350efe1730b7b8c008fa to your computer and use it in GitHub Desktop.
Save debdutdeb/eaabd2f6ae8c350efe1730b7b8c008fa to your computer and use it in GitHub Desktop.
Dockerfile and C program to demonstrate container pausing.
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" ]
#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