Bug 1274210

Summary: Docker volumes using the :z or :Z flag don't create the folder on the dockerd host
Product: Red Hat Enterprise Linux 7 Reporter: Alvaro Aleman <alv2412>
Component: dockerAssignee: Daniel Walsh <dwalsh>
Status: CLOSED NOTABUG QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: lsm5
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-28 14:35:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alvaro Aleman 2015-10-22 09:33:57 UTC
Description of problem:

Mounting a non-existent folder as volume into a Docker container using the :rw or :rw flag create that folder:

sudo rm -rf /tmp/nonexistent
sudo docker run -it -v /tmp/nonexistent:/tmp:rw debian:jessie bash

Doing the same using the :z or :Z flag causes an error:

sudo rm -rf /tmp/nonexistent
sudo docker run -it -v /tmp/nonexistent:/tmp:Z debian:jessie bash
Error response from daemon: no such file or directory

Version-Release number of selected component (if applicable):

grep docker <(yum list installed)
docker.x86_64                    1.7.1-115.el7                  @extras         
docker-selinux.x86_64            1.7.1-115.el7                  @extras


How reproducible: 100%


Steps to Reproduce:
1. sudo rm -rf /tmp/nonexistant
2. sudo docker run -it -v /tmp/nonexistant:/tmp:Z debian:jessie bash


Additional info:

Upstream bug: https://github.com/docker/docker/issues/17240

Comment 2 Daniel Walsh 2015-10-22 12:19:40 UTC
I guess I would question what the correct behaviour should be.  I would say that creating a directory is more dangerous then failing with an error.

Just having a spelling mistake could end up with the container having unexpected behaviour.

Probably should bring this up for discussion upstream.

Comment 3 Alvaro Aleman 2015-10-22 12:41:03 UTC
According to upstream the creation will be marked deprecated in Docker 1.9 and remove in Docker 1.11: https://github.com/docker/docker/issues/17240#issuecomment-149946431


What I really dislike about current behaviour is not the creation/not creation question but the inconsitentcy.

Comment 4 Daniel Walsh 2015-10-28 14:35:04 UTC
Well it looks like the :z and :Z is the correct behaviour, and docker will eventually move to it.