When you want to just run a simple script inside Docker, it’s quite convenient for you to memorize these docker commands and options.

$ docker build -t your-docker-image .
$ docker run -it --rm your-docker-image

Break down options

  • -it: for interactive processes, you must use -i and -t together to allocate a tty for the container process.
  • --rm: automatically clean up container and remove the file system when the container exits.

discussion