---
# System prepended metadata

title: Running c exectables in docker container

---

# Running c exectables in docker container


> loop.sh : This file contains the command to run open_and_sleep.

```
└──╼$ cat loop.sh 
#!/bin/bash

i=1; while :; do echo -en "\r$i  "; (./open_and_sleep f1 | { sleep 0.1; xargs -n1 kill -INT; }); i=$(($i+1)); done

```

1. Using busybox:glibc

```
FROM busybox:glibc
WORKDIR /home
COPY . ./
RUN chmod +x loop.sh && chmod +x open_and_sleep
CMD ["sh", "loop.sh"]

```

Build the docker image
```
$ docker build -t open_and_sleep .
```

Run the docker file
```
$ docker run -it --rm open_and_sleep
```


2. Using gcc:4.9

```
FROM gcc:4.9
WORKDIR /HelloWorld
COPY . ./
RUN chmod +x loop.sh && chmod +x open_and_sleep
CMD ["./loop.sh"]

```
Build the docker image
```
$ docker build -t open_and_sleep .
```

Run the docker file
```
$ docker run -it --rm open_and_sleep
```