Bug 1274210 - Docker volumes using the :z or :Z flag don't create the folder on the dockerd host
Summary: Docker volumes using the :z or :Z flag don't create the folder on the dockerd...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-22 09:33 UTC by Alvaro Aleman
Modified: 2019-03-06 01:59 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-28 14:35:04 UTC
Target Upstream Version:


Attachments (Terms of Use)

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.


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