dockerdocker-compose

Need to use docker-compose to build but but not run


This is my docker compose file:

name: polyocr
services:
  web-prebuild: 
    build:
      context: ./../..
      dockerfile: ./deployment/docker/web/Dockerfile.prebuild
    
      
  web:
    build: 
      context: ./../..
      dockerfile: ./deployment/docker/web/Dockerfile
    depends_on:
      - web-prebuild
    ports:
      - "80:8000"

It works for me, however, I don't need the "pre-build" docker to run. I just need it to be built before I start the other one. Is there a way for me to get docker-compose up to build all, but run only the web? Thanks


Solution

  • Unfortunately this is not possible with docker-compose. There are some workarounds described in this and this issue, but it cannot be solved using docker-compose.