By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
tmpfs mounts provide in-memory, temporary storage for Docker containers. docker run -it --tmpfs /tmp:rw.
docker info | grep "Total Memory"
docker run -it --tmpfs /tmp:rw --name tmpfs-test ubuntu /bin/bash
df -h | grep tmpfs
docker rm -f tmpfs-test
docker system prune -f
Purpose: Create a temporary storage for a container.Command: docker run -it --tmpfs /tmp:rw --name tmpfs-test ubuntu /bin/bash Flags: -it for interactive shell, --tmpfs /tmp:rw for tmpfs mount.
-it
--tmpfs /tmp:rw
Purpose: Create a persistent storage for a container.Command: docker run -it --mount type=tmpfs,destination=/tmp,ro --name tmpfs-test ubuntu /bin/bash Flags: --mount for tmpfs mount, ro for read-only.
docker run -it --mount type=tmpfs,destination=/tmp,ro --name tmpfs-test ubuntu /bin/bash
--mount
ro
Purpose: Create a large tmpfs mount for a container.Command: docker run -it --tmpfs /tmp:rw,size=2g --name tmpfs-test ubuntu /bin/bash Flags: size=2g for 2GB tmpfs mount.
docker run -it --tmpfs /tmp:rw,size=2g --name tmpfs-test ubuntu /bin/bash
size=2g
Error message: docker: Error response from daemon: failed to mount local volume: mount /tmp: mountpoint is not a directory.Why it happens: Tmpfs mount is not a directory.Fix: docker run -it --tmpfs /tmp:rw --name tmpfs-test ubuntu /bin/bash
docker: Error response from daemon: failed to mount local volume: mount /tmp: mountpoint is not a directory
Error message: docker: Error response from daemon: failed to mount local volume: mount /tmp: out of memory.Why it happens: Insufficient memory for tmpfs mount.Fix: docker run -it --tmpfs /tmp:rw,size=2g --name tmpfs-test ubuntu /bin/bash
docker: Error response from daemon: failed to mount local volume: mount /tmp: out of memory
Error message: docker: Error response from daemon: failed to mount local volume: mount /tmp: mountpoint is not a directory.Why it happens: Tmpfs mount is not persistent.Fix: docker run -it --mount type=tmpfs,destination=/tmp,ro --name tmpfs-test ubuntu /bin/bash
Situation: Check if tmpfs is enabled on your system.Command: docker info | grep "Total Memory" Correct response: Total Memory: 16.00 MB
Total Memory: 16.00 MB
Situation: Check if tmpfs mount is created.Command: docker inspect --format='{{.Mounts}}' tmpfs-test Correct response: [{Name:tmpfs,Mountpoint:/tmp,Source:/dev/zero,Type:tmpfs,Options:rw}]
docker inspect --format='{{.Mounts}}' tmpfs-test
[{Name:tmpfs,Mountpoint:/tmp,Source:/dev/zero,Type:tmpfs,Options:rw}]
Situation: Check if tmpfs mount is deleted.Command: docker inspect --format='{{.Mounts}}' tmpfs-test Correct response: []
[]
--tmpfs
:rw
size
docker info
docker inspect
docker system prune
docker rm -f
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.