How can we store container data in memory using docker volume?
We can use the tempfs as mount type.
This is a type of filesystem which is stored in container's memory, so this is temporary storage, when we stop the container, the data written to this tmpfs will be lost.
This is the fastest way to access memory.
It can be used to process the runtime data like some queue in storage, some mathematical formulas, etc.
We can not attach this volume with some other container because we don't know the Physical location in this case.
Below is the command for attaching tmpfs to container -
docker run -itd --name --mount type=tmpfs,destination=/opt/example ubuntu