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 ?

  • docker login - Keep Session Alive on CI Server - Stay Logged In
  • AWS EB with Docker, Node and Nginx Config Issues
  • Connect from a Docker container to port of another docker container
  • dockerized cassandra: java.lang.OutOfMemoryError: Java heap space
  • Docker - what does `docker run --restart always` actually do?
  • Docker containers: how do they work together?
  • IIS reverse proxy to virtual private ip
  • Mapping an existing local neo4j database to a neo4j docker container
  • Where is the Postgres username/password being created in this Dockerfile?
  • How can I achieve installing a application like Jenkins into a running CentOs container running inside a CentOs image using chef-recipe?
  • Unable to push a plugin using docker plugin push command
  • Facing Connection Timedout issue in RHEL7 OS while running the collectd-docker image
  • 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.