Terminate container after shell script dies

Hi,

I’d like to know how I can get a docker container to terminate after it’s parent shell script dies.
For example, I have a shell script like this:

#!/bin/sh
docker run centos sleep 1000

If I run the shell script and then, from another terminal, I kill the script, the container still runs.

How do I get the container to die with the parent script?