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

mount.cifs within a container #22197

Closed
psi-4ward opened this issue Apr 20, 2016 · 7 comments
Closed

mount.cifs within a container #22197

psi-4ward opened this issue Apr 20, 2016 · 7 comments

Comments

@psi-4ward
Copy link

Trying to mount.cifs results in Unable to apply new capability set

Tested docker run --cap-add SYS_ADMIN --cap-add MKNOD --device /dev/fuse
but with --privileged its working.

Can anyone tell my how to track down which CAPs i need?

@cpuguy83
Copy link
Member

@psi-4ward This is likely being filtered by seccomp.
You'd need to either turn off seccomp for the container or provide a new seccomp profile (which blocks mount, among other things, by default).

FYI, I believe MKNOD is available by default.

@psi-4ward
Copy link
Author

I tried that: --cap-add SYS_ADMIN --security-opt seccomp=unconfined --device /dev/fuse but i still get the error.

Can i log the blocked calls?

@cpuguy83
Copy link
Member

It's really difficult to tell what mount.cifs needs. It might be CAP_DAC_READ_SEARCH

@psi-4ward
Copy link
Author

psi-4ward commented Apr 20, 2016

Works ! THANKS! 👍

docker run ... \
  --cap-add SYS_ADMIN \
  --cap-add DAC_READ_SEARCH \
 shoifele/bareos-sd

Edit:
event without --security-opt seccomp=unconfined

@samuela
Copy link

samuela commented Sep 16, 2019

I'm trying the --cap-add SYS_ADMIN --cap-add DAC_READ_SEARCH config which got rid of the capability errors, but I'm still stuck with

mount error(11): Resource temporarily unavailable
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

even though the exact same mount command works fine in a VM.

@gekmcfh
Copy link

gekmcfh commented Oct 5, 2019

I'm trying the --cap-add SYS_ADMIN --cap-add DAC_READ_SEARCH config which got rid of the capability errors, but I'm still stuck with

mount error(11): Resource temporarily unavailable
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

even though the exact same mount command works fine in a VM.

Originally it's was

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I trying to achieve same with docker-compose.yml:

services:
  app:
    build: .
    container_name: app
    networks:
      net:
        ipv4_address: 10.0.10.10
    volumes:
      - .:/code
    ports:
      - 80:80
    depends_on:
      - db
    cap_add:
      - SYS_ADMIN
      - DAC_READ_SEARCH

when i inspect container after docker-compose up for the capabilities - here they are:

docker inspect a8afc275544a | grep -i cap -B 3
            "CapAdd": [
                "SYS_ADMIN",
                "DAC_READ_SEARCH"
            ],
            "CapDrop": null,
            "Capabilities": null,

but when trying to mount via mount -t or fstab, still getting

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

upd.
--privileged did the trick.

@pustekuchen91
Copy link

hey,

same error "no permission" like @gekmcfh.

--privileged seems to add any capability. So it seems that one is missing? I tried some, but didnt found out which could be missing.

dmesg shows this error CIFS: VFS: \\xyz.mydomain\IPC$ ioctl error in smb2_get_dfs_refer rc=-112. Could this be an hint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants