Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not unmount a device using "umount" in Docker

Tags:

docker

build

I don't know why but, umount is not working in docker.

umount: loop3/: must be superuser to umount

Let me share one more thing that is It creates loop3 under /mnt/loop3 in real machine. Which is most unexpected thing for me, because promises pure virtual environment.

Why? Any solution?

Scenario :

I created docker ubuntu:13.04 to create cross compilation environment.

  • Docker Linux machine (ubuntu):

    Linux 626089eadfeb 3.10.45-1-lts #1 SMP Fri Jun 27 06:44:23 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    
  • Linux Machine (rch Linux):

    Linux localhost 3.10.45-1-lts #1 SMP Fri Jun 27 06:44:23 UTC 2014 x86_64 GNU/Linux
    

Docker Info

Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.3
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.3
Git commit (server): 990021a
like image 336
Arun Gupta Avatar asked Jul 07 '14 15:07

Arun Gupta


1 Answers

I found the solution :

In default docker run it's not a real Operating system as we expect. It doesn't have permissions to access the devices. So we have to use --privileged While running a docker.

By default, Docker containers are "unprivileged" and cannot, for example, run a Docker daemon inside a Docker container. This is because by default a container is not allowed to access any devices, but a "privileged" container is given access to all devices.

When the operator executes docker run --privileged, Docker will enable to access to all devices on the host as well as set some configuration in AppArmor to allow the container nearly all the same access to the host as processes running outside containers on the host.

like image 167
Arun Gupta Avatar answered Nov 04 '22 04:11

Arun Gupta