Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1337409 - Mounting volume read-write under read-only volume mount fails
Summary: Mounting volume read-write under read-only volume mount fails
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: atomic-bugs@redhat.com
Depends On:
TreeView+ depends on / blocked
Reported: 2016-05-19 07:06 UTC by Jan Pazdziora
Modified: 2019-03-06 01:08 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2016-06-03 18:29:12 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Jan Pazdziora 2016-05-19 07:06:20 UTC
Description of problem:

When software wants to generate output in its subdirectory, it might be useful to mount volume for the output read-write, while reading the software itself read-only. Attempt to do that fails.

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


How reproducible:


Steps to Reproduce:
1. mkdir -p /tmp/parent-ro /tmp/child-rw
2. docker run -ti -v /tmp/parent-ro:/data:ro -v /tmp/child-rw:/data/_build:Z rhel7 bash

Actual results:

Timestamp: 2016-05-19 03:02:32.120707018 -0400 EDT
Code: System error

Message: mkdir /var/lib/docker/devicemapper/mnt/7279426326d7425f6f2c4c501c9ae43ce25a490a2b1bc11f392a9205fa11992c/rootfs/data/_build: read-only file system

0: setupRootfs
Package: github.com/opencontainers/runc/libcontainer
File: rootfs_linux.go@40
1: Init
Package: github.com/opencontainers/runc/libcontainer.(*linuxStandardInit)
File: standard_init_linux.go@57
2: StartInitialization
Package: github.com/opencontainers/runc/libcontainer.(*LinuxFactory)
File: factory_linux.go@242
3: initializer
Package: github.com/docker/docker/daemon/execdriver/native
File: init.go@35
4: Init
Package: github.com/docker/docker/pkg/reexec
File: reexec.go@26
5: main
Package: main
File: docker.go@18
6: main
Package: runtime
File: proc.go@63
7: goexit
Package: runtime
File: asm_amd64.s@2232
Error response from daemon: Cannot start container 7279426326d7425f6f2c4c501c9ae43ce25a490a2b1bc11f392a9205fa11992c: [8] System error: mkdir /var/lib/docker/devicemapper/mnt/7279426326d7425f6f2c4c501c9ae43ce25a490a2b1bc11f392a9205fa11992c/rootfs/data/_build: read-only file system

Expected results:

Container started, both volumes mounted.

Additional info:

Comment 2 Daniel Walsh 2016-06-03 18:29:12 UTC
1. mkdir -p /tmp/parent-ro /tmp/child-rw
2. docker run -ti -v /tmp/parent-ro:/data:ro -v /tmp/child-rw:/data/_build:Z rhel7 bash

The problem here is docker attempts to create the _build directory under /tmp/parent-ro after it is mounted ro.

1. mkdir -p /tmp/parent-ro/_build /tmp/child-rw

Would fix the problem.

There is no way to fix this since you started with a readonly directory.

Comment 3 Jan Pazdziora 2016-06-07 16:08:04 UTC
You are right, this fixes the problem. Thank you.

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