Reputation: 2268
I wanted to test my app inside docker container for the case when disk is 100% full, or when all system file-descriptors are used, or when memory is used 100% etc...
Is it possible to do this inside docker container? So far I can see that when 'df' command is executed, it shows size of the host system and not docker container one.
I just wanted to specify e.g. 1GB HDD and 1GB RAM, and then use some app to fill the disk and memory for testing.
Upvotes: 0
Views: 246
Reputation: 1198
Have you tried:
docker volume create --driver local \
--opt type=tmpfs \
--opt device=tmpfs \
--opt o=size=1g,uid=1000 \
my-new-volume
docker run -d -v my-new-volume:/in-container-location container-image
Have your app write to /in-container-location
Source - https://docs.docker.com/engine/reference/commandline/volume_create/#examples
docker run -d --memory="1g" container-image
source - https://docs.docker.com/config/containers/resource_constraints/#memory
docker run -d --memory="1g" -v my-new-volume:/in-container-location container-image
Upvotes: 2