4

I want to mount a tmpfs filesystem in docker container. For this I am passing mount command like this:

docker run --mount type=tmpfs,destination=/tempdisk,tmpfs-mode=770,tmpfs-size=4m --name projectname projectname:latest

The above command is working perfectly fine.

Is there a way to do this in dockerfile? or through shell script? I tried to implement through dockerfile like below:

RUN mkdir -p /tmpfolder
RUN chmod 777 /tmpfolder
RUN mount -t tmpfs -o size=32m tmpfs /tmpfolder

But it gives error at 3rd line when I do docker build as:

 mount: permission denied

Please guide me regarding this.

abc def
  • 55
  • 6

0 Answers0