Docker: Criando a Docker Image com o Python e Flask
echo 'from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "hello world!" if __name__ == "__main__": app.run(host="0.0.0.0")' > app.py
Vamos pegar por exemplo o arquivo Dockerfile abaixo:
FROM python:3.6.1-alpine RUN pip install flask COPY app.py /app.py CMD ["python","app.py"]
docker image build -t python-hello-world .
docker run -p 5001:5000 -d python-hello-world
http://localhost:5001
docker container logs [container id]
docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username:
docker tag python-hello-world [dockerhub username]/python-hello-world
docker push ebasso/python-hello-world