Skip to content

[doc] docker cp gives surprising result with tmpfs #22020

@AkihiroSuda

Description

@AkihiroSuda

When tmpfs is mounted on a container, docker cp copies the content of the underlying directory rather than the content of the tmpfs.

I'm not sure this is expected result or not.
But even if this is expected result, I think it is worth explictly mentioning this on the documentation.

Output of docker version:

Client:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   4dc5990
 Built:        Thu Apr 14 05:05:19 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   4dc5990
 Built:        Thu Apr 14 05:05:19 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 58
 Running: 1
 Paused: 0
 Stopped: 57
Images: 294
Server Version: 1.11.0
Storage Driver: overlay
 Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 4.2.0-30-generic
Operating System: Ubuntu 15.10
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.796 GiB
Name: ip-172-31-8-43
ID: 5HJM:SQPO:3NEM:ZYX7:3LME:WIHB:E3BN:RNMZ:6K4F:JCQ6:UY2Z:CR26
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): true
 File Descriptors: 17
 Goroutines: 43
 System Time: 2016-04-14T05:11:22.886582661Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):
AWS (not related to this issue)

Steps to reproduce the issue:
On Terminal 1:

host$ (cd DOCKER_SRC_DIR; make shell)
root@78e5073cf591:/go/src/github.com/docker/docker# ls /tmp
root@78e5073cf591:/go/src/github.com/docker/docker# echo foo > /tmp/foo.txt
root@78e5073cf591:/go/src/github.com/docker/docker# ls /tmp
foo.txt

On Terminal 2:

host$ docker cp 78e5:/tmp xtmp
host$ ls xtmp
pip_build_root/  tmp.KrRLOzisMN/  tmp.bRFDLAOQtb/

Describe the results you received:
pip_build_root/ tmp.KrRLOzisMN/ tmp.bRFDLAOQtb/

Describe the results you expected:
foo.txt

Additional information you deem important (e.g. issue happens only occasionally):

  • hack/dind mounts /tmp on a container and causes this surprising result.
  • Even reproducible by running docker run -it --tmpfs=/tmp --rm busybox instead of make shell.
  • Not reproducible by just running docker run -it --rm busybox instead of make shell.
  • Reproducible with Docker 1.10.3 + AUFS. So this is not new to 1.11 nor specific to Overlay.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions