Docker Community Forums

Share and learn in the Docker community.

Docker cp: unable to copy a file to the tmpfs inside the container

Note: container: /tmp/inside_tmp is a tmpfs
root@071e98dc1789:/tmp/inside_tmp# df
Filesystem 1K-blocks Used Available Use% Mounted on
overlay 482119132 27584676 434589856 6% /
tmpfs 65964316 0 65964316 0% /dev
tmpfs 65964316 0 65964316 0% /sys/fs/cgroup
/dev/sda9 482119132 27584676 434589856 6% /etc/hosts
shm 65536 0 65536 0% /dev/shm
tmpfs 65536 0 65536 0% /tmp/inside_tmp

node-001e67f85a08 docker # docker --version
Docker version 1.11.2, build bac3bae
node-001e67f85a08 docker # docker cp /tmp/jtest_tmp/test test_container:/THIS <-- WORKS, can see the file inside the container: /THIS
node-001e67f85a08 docker # docker cp /tmp/jtest_tmp/test test_container:/tmp/inside_tmp/THIS <ā€” This does NOT work. No file at /tmp/inside_tmp/THIS inisde the container. Any idea why?
node-001e67f85a08 docker # echo $?
0
node-001e67f85a08 docker #

Iā€™m running into the same issue as well. Not able to docker cp any file present under /tmp inside container onto the host directory. Is this expected behavior?

As stated in the documentation for cp

It is not possible to copy certain system files such as resources under /proc , /sys , /dev , tmpfs, and mounts created by the user in the container. However, you can still copy such files by manually running tar in docker exec . Both of the following examples do the same thing in different ways

1 Like