I have a a docker compose file, which builds some services using a Dockerfile which is stored with it, the compose looks something like this
version: '3.5'
services:
my_app:
build: ""
image: my_image
....
...
my_two:
image: my_image
...
my_three:
image: my_mage
...
Now when I run docker-compose up what happens is the image is built (build: "" find the Dockerfile and builds it and names it "my_image") and then the other two (my_two, my_three) are using the already built image.
So far so good.
The problem is that when I run docker-compose down --rmi all it successfully removes my_image but then retries two times to remove the image again, because they are associated with other services.
The operation does what it needs to do, stopping and removing all containers and removing the images but the problem is that it displays error messages - which I want to avoid as I am wrapping some software around it.
How can I make docker-compose remove the image only once?