0

I am inside a docker container build atop of the image alpine:3.6 and I am trying to find if a directory exists. I get te error,

find: './proc/1/map_files': Permission denied

This is the commands I used for the search,

root@5f4776320924:/# ls
bin   docker-entrypoint-initdb.d  home   media  proc  sbin  tmp
boot  entrypoint.sh       lib    mnt    root  srv   usr
dev   etc             lib64  opt    run   sys   var
root@5f4776320924:/# find . -type d | grep "adminer"
find: './proc/1/map_files': Permission denied

If I try to use the root using $ su -, I only get inside the root folder and I wasn't able to perform the search.

What's the issue here? I think the searching command is correct.

3

Your command is correct (although a bit overcomplicated, using the name option of find instead of grepping would be better).

find / -type d -name adminer

/proc is a very special filesystem which contains information about running processes. Therefore, not everything is accessible (not even to root). The Linux Documentation Project has a good writeup:

https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html

  • I have checked the page you mentioned, but, this is kind of over the edge. What do we need to do to find a directory in the Linux container? – Arefe Mar 19 at 9:57
  • The command is correct! If it doesn't return something, then the directory does not exist. You should use find / -type d -name adminer (and if you don't want to see the error messages, add 2>/dev/null) – Panki Mar 19 at 10:12
  • 1
    still, it would've been interesting to know why /proc/1/map_files/ is not readable by the "root" from a docker container. Saying that /proc is "very special" isn't very edifying -- I'm very special, too ;-) – mosvy Mar 19 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.