I’ve had the exact same issue with the latest version of the tutorial at part 4, “Accessing your Swarm”.
I had a clean run on the tutorial (no extra images or containers, correct port configuration on docker-compose), I tried restarting Docker and no love. What do I do?
My files are quoted here, default from the tutorial.
from flask import Flask
from redis import Redis, RedisError
#Connect to Redis
redis = Redis(host=“redis”, db=0, socket_connect_timeout=2, socket_timeout=2)
app = Flask(name)
visits = redis.incr(“counter”)
visits = “cannot connect to Redis, counter disabled”
html = “
return html.format(name=os.getenv(“NAME”, “world”), hostname=socket.gethostname(), visits=visits)
if name == “main”:
# replace username/repo:tag with your name and image details
Use an official Python runtime as a parent image
Set the working directory to /app
Copy the current directory contents into the container at /app
COPY . /app
Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt
Make port 80 available to the world outside this container
Define environment variable
ENV NAME World
Run app.py when the container launches
CMD [“python”, “app.py”]
Terminal Response from creating VM’s until swarm created
I’m on a mid 2015 15inch Mac running High Sierra. Help is appreciated. Also, please note that the blockquotes wreck all of the spacing and comments from the files, but as I am not able to attach them, you have to just trust that I literally copied and pasted from the tutorial.