See if a Docker Container Exists With a Specific Name

I am trying to find if a Docker Container with a specific name exists, but I seem to be unsuccessful. I have found multiple answers from other posts, the most notable one being this one, but I cannot seem to reproduce their success. Their answer returns nothing when it is tried with the container in multiple states (sometimes stopped, sometimes running), but I can’t seem to get an output. It is not supposed to do anything if the container is running for right now. The block of code that I’ve been using is:

if [ ! "$(docker ps -q -f name=mysql80)" ]; then
    if [ "$(docker ps -aq -f status=exited -f name=mysql80)" ]; then
        # cleanup
        docker rm mysql80
    # run your container
    docker run -d -p 3306:3306 -p 33060:33060 --volume "$MYSQLFOLDERLOCATION":/var/lib/mysql --name mysql80 frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0

I expect this block of code to find the container, and remove it if it is exited. I know this can sometimes be hazardous.

Source: Docker Questions