Since -i keeps STDIN open even if not attached, it allows for composition (piping).
For example:
docker run --rm ubuntu printf "line1\nline2\n" | docker run --rm -i ubuntu grep line2 | docker run --rm -i ubuntu sed 's/line2/line3/g'
(Source: issue 14221)
Or:
$ echo hello | docker run --rm -i busybox cat
hello
(Source: issue 12401)
Now imagine this not in front of a keyboard and being used in a script where you can actually write to the processes stdin through something better than a shell
|: exampleintegration-cli/docker_cli_attach_test.go
As noted in the comments by Pixelbog, adding the --rm option avoid leaving a bunch of ‘Exited‘ containers.