My script.sh:
#/bin/sh
docker run --name foo 
(Just assume that the docker command works and the container name is foo. Can't make the actual command public.)
I have a script that runs a docker container. I want to check that it ran successfully and echo the successful running status on the terminal. 
How can I accomplish this using the container name? I know that I have to use something like docker inspect but when I try to add that command, it only gets executed after I ^C my script probably because docker has the execution. 
In this answer, the docker is executed in some other script so it doesn't really work for my use case.
 
     
     
     
    