Docker Community Forums

Share and learn in the Docker community.

Cannot change modification time of a file inside a mounted volume


(Federico Saravia) #1

Hi!

I have a problem in which I cannot update the modification time of a file that exists on a mounted volume. It works okay on any file that has been copied or created inside the container.

Expected behavior

Running touch -d on a file on a mounted volume should be able to update the file modification or access time.

Actual behavior

Running touch -d on a file on a mounted volume doesn’t return an error but doesn’t work.

Information

OSX Version: 10.11.4
Docker for Mac version: Version 1.11.1-beta10 (build: 6662)
Pinata diagnose results OK

Steps to reproduce the behavior

docker run --rm -ti -v $(pwd):/opt/volume alpine:3.2 sh

/ # cd /opt/volume
/opt/volume # touch something
/opt/volume # ls -l something 
-rw-r--r--    1 root     root             0 May  5 17:17 something
/opt/volume # touch -m -d "2004-02-29 16:21:42" something
/opt/volume # echo $?
0
/opt/volume # ls -l something 
-rw-r--r--    1 root     root             0 May  5 17:17 something
/opt/volume # 

(Charnits) #2

I’m seeing the same problems on beta11. When extracting tarballs to a mac volume the modification time isn’t preserved which screws up building.

$ docker run --rm -ti -v $(PWD):/tmp/volume -w /tmp ubuntu /bin/bash

# mkdir docker
# tar --strip-components=1 -C docker -zxf sqlite-autoconf-3120200.tar.gz
# tar --strip-components=1 -C volume -zxf sqlite-autoconf-3120200.tar.gz

# stat docker/INSTALL | grep Modify
Modify: 2016-04-18 18:56:32.000000000 +0000

# stat volume/INSTALL | grep Modify
Modify: 2016-05-11 13:52:50.000000000 +0000

(Federico Saravia) #3

I can confirm that this has been fixed on 1.11.1-beta13 (build: 7975). Thank you!


(Dave Tucker) #4