Bug 1274210 - Docker volumes using the :z or :Z flag don't create the folder on the dockerd host
Docker volumes using the :z or :Z flag don't create the folder on the dockerd...
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Daniel Walsh
: Extras
Depends On:
  Show dependency treegraph
Reported: 2015-10-22 05:33 EDT by Alvaro Aleman
Modified: 2015-10-28 10:35 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-10-28 10:35:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Alvaro Aleman 2015-10-22 05:33:57 EDT
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 08:19:40 EDT
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 08:41:03 EDT
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 10:35:04 EDT
Well it looks like the :z and :Z is the correct behaviour, and docker will eventually move to it.

Note You need to log in before you can comment on or make changes to this bug.