Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use setfacl within a Docker container?

It seems like within the container the filesystem is mounted without 'acl', therefore 'setfacl' won't work. And it won't let me remount it either, and I can't even run 'df -h'.

I need setfacl because I make root own all the files from my websites, and I give the webserver user write permissions to only a few directories like cache, logs, etc.

What can I do?

like image 918
ChocoDeveloper Avatar asked Mar 28 '14 13:03

ChocoDeveloper


People also ask

Can ASP NET application be run in Docker containers?

Run the ASP.NET Core Application in Docker ENTRYPOINT is one of the mechanisms that make that work. When you run a container, Docker executes the command specified by the ENTRYPOINT . In the case of your application, that command is dotnet OktaMVCLogin. dll .

Can we have multiple entry points in Docker?

But since Docker allows only a single ENTRYPOINT (to be precise, only the last ENTRYPOINT in the Dockerfile has an effect), you need to find a way to run multiple processes (the tunnel and the application) with a single command. Let's see how you can do it.

Can we run each app in an isolated container in the Docker?

Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allows you to run many containers simultaneously on a given host.

Can Docker run singularity?

Singularity can also start containers directly from Docker images, opening up access to a huge number of existing container images available on Docker Hub and other registries.


1 Answers

The good news is that Docker supports ACLs.

In early releases Docker used a filesystem named AUFS which didn't support them. You could tell Docker to use Device Mapper (LVM) for its storage, by starting your Docker daemon with the appropriate option:

docker -d --storage-driver=devicemapper --daemon=true

Source: https://groups.google.com/forum/#!topic/docker-user/165AARba2Bk

and then you were able to use setfacl in your containers.

Any reasonably recent release or Docker now uses the overlay2 storage driver, which supports that out of the box. To check what is your storage driver:

docker info | grep Storage

df -h doesn't work for a different and unrelated reason : it relies on /etc/mtab, not present in your case. In your container, create a link from procfs, that will solve this problem:

ln -s /proc/mounts /etc/mtab
like image 167
mbarthelemy Avatar answered Oct 01 '22 00:10

mbarthelemy