-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Description
in a Dockerfile, after a path has been declared as a VOLUME, one can't add more files from RUN executions that will persist when volume is later created as a container is ran, but COPY can.
According to the reference documentation
Changing the volume from within the Dockerfile: If any build steps change the data within the volume after it has been declared, those changes will be discarded.
Steps to reproduce the issue:
- build this Dockerfile : https://github.com/ndeloof/bug
- run a container from it
Describe the results you received:
docker run bug
1.txt
2.txt
3.txt
Describe the results you expected:
docker run bug
1.txt
2.txt
or
docker run bug
1.txt
2.txt
3.txt
4.txt
but not something in the middle
Additional information you deem important (e.g. issue happens only occasionally):
if COPY can add files to a pre-declared VOLUME, then it would be great the same happens to RUN. Images like the official jenkins one have for sample to use some intermediate folders to let downstream images amend the volume content, with entrypoint script to copy files there.
Output of docker version:
Client:
Version: 17.06.0-ce-rc5
API version: 1.30
Go version: go1.8.3
Git commit: b7e4173
Built: Tue Jun 20 07:14:13 2017
OS/Arch: darwin/amd64
Server:
Version: 17.06.0-ce-rc5
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: b7e4173
Built: Tue Jun 20 07:18:21 2017
OS/Arch: linux/amd64
Experimental: true
Output of docker info:
Containers: 25
Running: 0
Paused: 0
Stopped: 25
Images: 107
Server Version: 17.06.0-ce-rc5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.31-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: moby
ID: 6UPI:IP6U:JJU2:JKGB:JAIG:KUHK:MOHQ:RLG6:XMTZ:W5XV:RGLC:OCFZ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 19
Goroutines: 30
System Time: 2017-06-27T11:34:09.862973854Z
EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false