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 ?

  • unable to launch dockerized node app in browser
  • alpine linux — autossh (missing)
  • Docker container published via port forward can't connect to its own published port
  • ansible-container variables in playbook
  • docker-compose up -d error
  • Make Docker image error
  • How do I give an own ip address to docker for Windows container?
  • Vue.js Webpack Template in a Docker Container: How do I add Webpack-Dev-Server --watch-poll flag?
  • Problems creating OpenShift app using Dockerfile (with oc new-app)
  • Get the host IP from my django app container
  • PostgreSQL docker container on Widnows
  • Bind-mount a host directory into a volume of a running 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.