Reputation: 8044
Following the tutorial of docker compose. Let's say you have a Dockerfile for your app and docker-compose.yml for its services.
Dockerfile
FROM ruby:2.3.3
...
COPY . /myapp
docker-compose.yml
version: '3'
services:
db:
image: postgres
web:
build: .
image: dre-hh/myapp
volumes:
- .:/myapp
depends_on:
- db
While developing you would like to build the app from the local filesystem with docker-compose. Then later you could upload the app docker image to docker hub.
Do you need separted overridable configurations if you want to choose between building from local system or from docker hub? Or is it possible somehow else as one can specify both build and image options on the yaml file?
Upvotes: 1
Views: 1019
Reputation: 91
When using build: with image:, the image name is simply to let you choose which name that docker-compose will tag the image as. To push images, you should use a different config / build workflow, as lvonet mentioned
Upvotes: 4