skip to Main Content

The following not work as expect:

  docker run --rm -it -v /tmp/folder/:/folder --entrypoint /bin/sh image  

In container, /folder exists but individual files that are present under /tmp/folder/ are missing and only asterisk is there.

In the container,

  ls /folder
  *

2

Answers


  1. Chosen as BEST ANSWER

    This turned out to be permission error. Directory need o+rx


  2. The /tmp/folder directory should have at least read and execute permissions. This can be changed by issuing the command sudo chmod o=rx /tmp/folder or sudo chmod o=rwx /tmp/folder, provided that no additional attributes or ACLs are applied.

    user@legion:~$ mkdir /tmp/folder
    user@legion:~$ touch /tmp/folder/cos
    user@legion:~$ docker run -it --rm -v /tmp/folder:/folder ubuntu:latest
    root@34e248dfb377:/# ls -l /folder
    total 0
    -rw-rw-r-- 1 1000 1000 0 May 13 17:25 cos
    

    Let us know if it worked.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search