I am currently in the process of learning Docker. After reading the docs and a few articles I obviously have more questions than answers. Most intriguing one for me at the moment is: what is the difference between
In Dockerfile and
I do understand that they should grab the image and create a container from it. What I don’t understand is what happens if we will specify both at the same time, for example:
version: '3' services: #PHP Service app: build: context: . dockerfile: Dockerfile image: digitalocean.com/php
Both docker-compose.yml and Dockerfile have images specified in them.
What happens when those images are different?
Will docker-compose.yml always win and for that one service? Will it use only this ‘top’ image?
Will they overlap somehow?
Or maybe I got it all wrong?
I did see this but I am still not sure if I understand what is going on.