Skip to content

Chapter 17: Clarification on build: vs volumes: in Docker Compose for production #47

@shaydulin

Description

@shaydulin

Hi, I’m trying to understand the recommended setup for production. In your docker-compose.yml, the web service uses both:

build: .
volumes:
  - .:/code

Since build: creates an image with the project files copied, and volumes: mounts the local directory over the container, doesn’t this override the image content?

Is this intended for development only, or should this be used in production as well? Could you clarify the reasoning behind using both at the same time?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions