Docker Compose Tutorial Issues

Hi all,

I’m a beginner in programming as well as docker. I was following the Docker Compose tutorial here: Try Docker Compose | Docker Docs. I followed every step and can’t seem to start the application with docker-compose up I got this error:

web_1 | Traceback (most recent call last):
web_1 | File “”, line 7, in
web_1 | app = Flask(test)
web_1 | NameError: name “test” is not defined

I created just like in the tutorial:
import time

import redis
from flask import Flask

app = Flask(__name__)
cache = redis.Redis(host='redis', port=6379)

def get_hit_count():
    retries = 5
    while True:
            return cache.incr('hits')
        except redis.exceptions.ConnectionError as exc:
            if retries == 0:
                raise exc
            retries -= 1

def hello():
    count = get_hit_count()
    return 'Hello World! I have been seen {} times.\n'.format(count)

if __name__ == "__main__":"", debug=True)

Since I keep getting the Name error so I can’t access the local host. Can someone help me with this?
Thank you


What you created is a small python application. You cannot start it with docker-compose up. I suggest you continue the tutorial further and follow the instructions, as the actual docker compose file is created in step 3 and you can call docker-compose up at step 4