Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inability to use bind mounts if source is on / #37032

Closed
kolyshkin opened this issue May 10, 2018 · 6 comments

Comments

@kolyshkin
Copy link
Contributor

commented May 10, 2018

  1. When running a recent version of docker-ce, it is not possible to create a bind mount for a directory which is on / (i.e. a root mount point):

docker run -ti -v /var/lib/kubelet:/dummy:shared,z ubuntu /bin/bash
docker: Error response from daemon: linux mounts: Could not find source mount of /var/lib/kubelet.

  1. There is a warning on daemon start (reported docker/for-linux#290 (comment)):

5月 04 22:49:29 docularxu-Precision-7520 dockerd[9003]: time="2018-05-04T22:49:29.592148011+08:00" level=warning msg="Error while setting daemon root propagation, this is not generally critical but may cause some functionality to not work or fallback to less desirable behavior" dir=/var/lib/docker error="error getting daemon root's parent mount: Could not find source mount of /var/lib/docker"

Workaround

For those suffering from the issue (only Docker CE 18.05 is affected), a quick workaround is to bind mount the directory on the host to itself, i.e. do mount --bind $dir $dir before starting a container. Here's a full example:

# docker run -ti -v /var/lib/kubelet:/dummy:shared,z ubuntu /bin/bash
docker: Error response from daemon: linux mounts: Could not find source mount of /var/lib/kubelet.
# mount --bind /var/lib/kubelet /var/lib/kubelet
# docker run -ti -v /var/lib/kubelet:/dummy:shared,z ubuntu /bin/bash
root@984f30b36d51:/#
@kolyshkin

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2018

The cause is commit 871c957.

@kolyshkin

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2018

fix: #37031

@thaJeztah thaJeztah added the kind/bug label May 11, 2018

@thaJeztah

This comment has been minimized.

Copy link
Member

commented May 11, 2018

#37031 was merged

@Arau

This comment has been minimized.

Copy link

commented May 11, 2018

Hi,

I experienced an error mounting a volume with a rshared flag that would be explained by this issue. Besides, the error message matches with the commits mentioned in here. It is happening on the release 18.05.0-ce, but NOT on 18.04.0-ce.

However, the error occurs mounting a different dir than /, and I'd like to double check with you that the fix also applies.

Version

root@storageos-1:~# docker version
Client:
 Version:      18.05.0-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   f150324
 Built:        Wed May  9 22:16:25 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.05.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   f150324
  Built:        Wed May  9 22:14:32 2018
  OS/Arch:      linux/amd64
  Experimental: false

Context

vagrant@storageos-1:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.4 LTS
Release:	16.04
Codename:	xenial

Example

vagrant@storageos-1:~$ docker run -it -v /var/lib/storageos:/var/tmp:rshared busybox sh -c /bin/date
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
f70adabe43c0: Pull complete 
Digest: sha256:58ac43b2cc92c687a32c8be6278e50a063579655fe3090125dcb2af0ff9e1a64
Status: Downloaded newer image for busybox:latest
docker: Error response from daemon: linux mounts: Could not find source mount of /var/lib/storageos.

Using the previous release, working example:

vagrant@storageos-2:~$ docker version
Client:
 Version:	18.04.0-ce
 API version:	1.37
 Go version:	go1.9.4
 Git commit:	3d479c0
 Built:	Tue Apr 10 18:20:32 2018
 OS/Arch:	linux/amd64
 Experimental:	false
 Orchestrator:	swarm

Server:
 Engine:
  Version:	18.04.0-ce
  API version:	1.37 (minimum version 1.12)
  Go version:	go1.9.4
  Git commit:	3d479c0
  Built:	Tue Apr 10 18:18:40 2018
  OS/Arch:	linux/amd64
  Experimental:	false
vagrant@storageos-2:~$ docker run -it -v /var/lib/storageos:/var/tmp:rshared busybox sh -c /bin/date
Fri May 11 15:38:04 UTC 2018
@cpuguy83

This comment has been minimized.

Copy link
Contributor

commented May 11, 2018

@Arau Thanks, the fix for the issue was merged into master this morning.

@kolyshkin

This comment has been minimized.

Copy link
Contributor Author

commented May 24, 2018

For those suffering from the issue, a quick workaround is to bind mount the directory on the host to itself:

# docker run -ti -v /var/lib/kubelet:/dummy:shared,z ubuntu /bin/bash
docker: Error response from daemon: linux mounts: Could not find source mount of /var/lib/kubelet.
# mount --bind /var/lib/kubelet /var/lib/kubelet
# docker run -ti -v /var/lib/kubelet:/dummy:shared,z ubuntu /bin/bash
root@984f30b36d51:/#
spantaleev added a commit to spantaleev/matrix-docker-ansible-deploy that referenced this issue May 29, 2018
Indicate that Ubuntu Bionic (18.04) is not supported yet
We have 2 blockers that prevent us from adding support:

- the Docker CE repository does not publish a `docker-ce` package
in the `stable` channel. It's still in `edge`
(can be worked around by using `edge`, but we'd better not)

- Docker bind propagation has troubles on Docker CE 18.05,
which breaks matrix-synapse.service from starting, as it wants to do
a `:slave` mount. See moby/moby#37032
@pohly pohly referenced this issue Jul 25, 2018
0 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.