0

Let say I am copying files in a Dockerfile. For example, I am copying a file called config.txt.

What is the best way, to copy a new config.txt file from the docker stack command, that will thus change the existing config.txt file that wass copied from the Dockerfile?

Is using a volume in the stack file the best practice ?

Dockerfile

FROM ubuntu:18.04
COPY ./configs /app/configs
RUN make /app
CMD python /app/app.py

stack.yml

version: '3.1'
services:
  python-app
    image: url:image
    volumes:
      - ./configs/config.txt:/app/configs  // modify the existing config.txt file

  ...

nolwww
  • 1,355
  • 1
  • 15
  • 33
  • What do you mean exactly by override? What do you want to change? – Arnaud Claudel Jun 19 '20 at 16:04
  • It depends on the stage. Bind mount is super useful during development as you can see your changes live without restarting container. But it makes the container dependent on your local environment. Usually you develop with bind mount and then when ready to release you COPY the final version and publish so it gets deployed consistently to production – Son Nguyen Jun 23 '20 at 17:50

0 Answers0