Image deletion stopped by existing container

I created a new image using:

docker build myimagename .

Then I ran it using:

docker run -it myimagename

I exit. Then I try to delete the image using:

docker rmi myimagename

At this point is I get the error:

Error response from daemon: conflict: unable to remove repository reference "myimagename" (must force) – container 474fb07acd2a is using its referenced image f5fdf1fb2339

However, when I check using docker container ls -a the container list shows that container exited. So why is the image removal blocked?

submitted by /u/ringosrule
[link] [comments]
Source: Reddit