Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker - Is volume mounted before running CMD

I have docker compose like

volumes:
      - ./:/app

and dockerfile like

WORKDIR /app
CMD [ "npm", "run", "build"]

It working but i don't know somecase it don't work?. If volume mounted before CMD run, it will working but i don't know is that true?. I don't want copy file in docker file and if volume mounted before CMD run that sound good. Anybody know Is volume mounted before running CMD? (more: is that same with command in composer?) any document refer thanks.

like image 543
DeLe Avatar asked Oct 12 '25 09:10

DeLe


1 Answers

Yes, volume is mounted before CMD is run.

This is covered in the OCI runtime spec with the "mount operations" before the runtime.

like image 68
danblack Avatar answered Oct 15 '25 08:10

danblack