I am working on my development machine and using a postgres database image into which I load a fairly large amount of data (takes ~15 minutes to load the whole thing). I have a secondary image which reads data from this database as part of my application. Since I don’t intend to change anything in the database once I load the data into it, I don’t want it to rebuild the image every time I run docker-compose up. To avoid that I always call
docker-compose build my_flask
But it seems that after I reboot my computer, calling
docker-compose up decides to rebuild the postgres image anyway, forcing me to sit through the lengthy loading process any time I reboot the computer. How can I stop this from happening?
version: "3" services: postgis: image: mdillon/postgis hostname: leni_prototype_postgis container_name: leni_prototype_postgis environment: - POSTGRES_PASSWORD=postgres networks: - mynetwork expose: - "5432" - "22" ports: - "5433:5432" volumes: - ./mnt/pg_init_data:/docker-entrypoint-initdb.d:z restart: always flask_server: build: ./flask/Docker/ hostname: my_flask container_name: my_flask networks: - my-network expose: - "5005" ports: - "5005:5005" volumes: - ./flask/Docker/app/grass_data:/grass_data - /var/run/docker.sock:/var/run/docker.sock depends_on: - postgis restart: always networks: my-network: driver: bridge