What are advantages of writing script file in Docker?

What are advantages of writing commands inside script file and running that script in Dockerfile rather than directly writing instructions inside Dockerfile ?

  • How to name Dockerfiles
  • Docker: Mixing distros - any disadvantage?
  • Template parsing error: template: :1: unclosed action
  • nginx reverse proxy docker - filter by location
  • Can I run a docker container with an own, externally and host accessible, IP address on a Mac
  • How do I change the umask of a shared docker volume?
  • Can I run windows containers using docker-toolbox on windows 7?
  • Failed to load OSETUP.dll when installing Excel in Windows docker container
  • Can I use docker to provide a simple file overlay over my current system?
  • Passing multiple env files in docker run command
  • Docker compose version 2.1+ on mac
  • Apache remap to apache within docker container
  • One Solution collect form web for “What are advantages of writing script file in Docker?”

    I assume you are referring to writing a script like

    cmd1
    cmd2
    cmd3
    

    instead of directly writing

    RUN cmd1
    RUN cmd2
    RUN cmd3
    

    in the Dockerfile. The benefit is that each RUN command executes a separate script. By writing a single script, you only need to execute one script. This gives both better performance, and allows you to share data via variables from one command to the next.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.