1

I'm new to coding and been fiddling around with docker containers and services

I have installed a temporary vscode server on my raspberry and deployed on my local lan for accessing it from various machines

Now i've been trying to create a flask app and run it from the container and trying to figure out how to publish and run the flask web server since i can't figure out what ip should i host it on (the default i always used was host=127.0.0.1 port=8080, but that would bring me to the local machine i'm visiting it from)

So while i was troubleshooting to understand what to do with exposed ports etc i've stopped the container and changed the docker-compose file, (i have a path set for the config's permanent storage, so my vscode setting are actually saved and persistent between deployments)

But I'm having the problem that every time i stop and re deploy the container i loose my python3 installation, and have to re run apt-update, apt-upgrade, apt install python3-pip and every python packages i need for the project

Where am i going wrong?

Silly question, but where does python get installed, and why isn't it persistent since i have my config path set?

I read that python gets installed in usr/local/lib, should i also map those directories to the persistent storage folder?

how should i do that?

thanks

Divroth
  • 49
  • 1
  • 5
  • 3
    Either use an [image that already has python](https://hub.docker.com/_/python) or build your image to have whatever you want it to have through a `Dockerfile` – Ofer Sadan Aug 11 '22 at 12:28
  • Related to local host: https://stackoverflow.com/q/61678129/5069105 – Raf Aug 11 '22 at 12:30
  • in your `Dockerfile`, just do: `FROM python:3.10` or whatever python you're using. – Raf Aug 11 '22 at 12:32
  • Thanks for the hints, while looking into it, since i'm not too familiar with building my images, i've stumbled upon a link that mentions docker_mods in the same page in Docker_hub where i pulled the image There are official mods to the Docker Image that passed as an environment variable, they pull the preset image for the one that has python included – Divroth Aug 11 '22 at 13:36

0 Answers0