0

My flask app is not running on docker currently I am running it from an IDE. And it has 4 files named app.py(https://pastebin.pl/view/e9590e45), main.py(https://pastebin.pl/view/5896caaf), esp32_simulator.py(https://pastebin.pl/view/c5428a6d) and SensorData.py(https://pastebin.pl/view/440b69f4). My cassandra is running on docker on a separate network from other things. I have a kafka-stack-docker-compose(which I pulled from confluentinc/kafka-images) which has 2 containers named kafka1, zoo1 running inside a stack named kafka-stack-docker-compose. I need to somehow add my python flask application to run on docker and then I need to somehow make these 3(flask, cassandra, kafka) connect and work together so I can share this docker containers with my supervisor for him to run it on his own computer.

I tried setting up a new network and running it all on the same but I currently have too much data both on my cassandra(table's and such) and my kafka(keyspaces) so I am afraid to delete them and configure them again.

1 Answers1

1

How can I dockerize my Flask App

The Docker blog seems to cover this on its own.

need to somehow make these 3(flask, cassandra, kafka) connect and work together

You would do this in one Compose file, and therefore one network, by default.

I suggest referring the Docker Compose documentation on how containers would be networked together. Then Kafka has specific environment variables to configure, but Cassandra should work the same as any other external service.

share this docker containers with my supervisor for him to run it on his own computer.

You can push your Docker image to DockerHub, or a private Docker Registry in your company, if one is available. Otherwise, you need to share your source code, Dockerfile and docker-compose file, then require your supervisor to have Docker installed as well... IMO, it would be easier to run your Flask app somewhere else like Google Cloud Run, then provide an accessible HTTP URL and hide away the backend services.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245