I am testing how an application (influxDB) handles a power failure as I have a problem in production with it. Currently, I have an embedded linux device that has the problematic software and to recreate the issue I must connect to the embedded device, make it write to influx DB and unplug it while it is writing. All of that is really tedious because I must get up to another room and unplug the device guessing the time. Than again connect to it, after it boots… This is slow and may harm my only device I have with me (home office).
Instead of using the physical embedded linux device where I need to unplug the device manually I want to simplify the process with docker. With docker I can simulate the process locally on my ARM PC up until the power failure (virtual unplugging, I do not want to unplug my PC). Is there a way to do it in docker?
I tried shutting down the docker, but I am not sure it recreates the sudden lost of power to the device.
2
Answers
No, you can’t simulate a "power failure" in docker, as the kernel is shared. You might be interested in real virtualization.
You can try
docker container kill
https://docs.docker.com/engine/reference/commandline/container_kill/
Docker kill commands instantly stop the container without taking any time. It is similar to the docker stop command, it just sends a SIGKILL signal to the running container process.
docker container kill [OPTIONS] CONTAINER [CONTAINER...]
https://docs.docker.com/engine/reference/commandline/kill/