Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 216
GuruYaya Avatar asked Oct 25 '25 07:10

GuruYaya


1 Answers

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.

like image 178
ABWassim Avatar answered Oct 26 '25 23:10

ABWassim