Create a Python app (without using Docker)
echo 'from flask import Flask
app = Flask(__name__)
@[Link]("/")
def hello():
return "hello world!"
if __name__ == "__main__":
[Link](host="[Link]")' > [Link]
Create a file named Dockerfile and add the following content:
FROM python:3.6.1-alpine
RUN pip install flask
CMD ["python","[Link]"]
COPY [Link] /[Link]
docker image build -t python-hello-world .
docker run --detach \
--name python-hello-world \
-p 5001:5000 \
python-hello-world
docker service create \
--name python-hello-world \
--network file-net \
--publish 5001:5000 \
python-hello-world
Navigate to [Link] in a browser to see the results.
docker login
docker tag python-hello-world jkfels/python-hello-world
docker push jkfels/python-hello-world
Check your image on Docker Hub in your browser.