Andrea Fresa
Andrea Fresa

Reputation: 341

Docker Container: pinging for a defined amount of time

I am using an alpine container to ping another docker container. I want to ping my docker container for 3 minutes and pipe the output to a ping.csv file. I used the Dockerfile that I will post in the code section. It is happening is that after a few seconds the container is in exited status. Any idea on how can I solve it? Here is the Dockerfile:

FROM alpine:latest
COPY . .
ENTRYPOINT timeout --preserve-status 180 ping 172.19.1.3 > ping.csv

Thanks for the help.

Upvotes: 0

Views: 359

Answers (2)

Andrea Fresa
Andrea Fresa

Reputation: 341

I solved the problem using:

ENTRYPOINT ping -w 180 172.19.1.3 > ping.csv

Thanks anyway for the help :)

Upvotes: 0

LinPy
LinPy

Reputation: 18598

you can try to update your timeout package:

apk update && apk add --no-cache coreutils

the problem is that timeout on this image does not recognize the --preserve-status

Upvotes: 1

Related Questions