JeanBritz

docker compose copying files example

Jul 10th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. build.context = folder in which dockerfile is
  2. build.dockerfile = name of dockerfile
  3.  
  4. When doing COPY command in the Dockerfile then only the files specified by the build.context is available
  5.  
  6. For example:
  7.  
  8. You have folder `postgresql` with dockerfile and scripts in.
  9. Then if you have a COPY command in the dockerfile and you want to copy a script such as `initdb.sql`
  10. Like:
  11. COPY initdb.sql /var/lib/postgresql/data
  12. Then your docker-compose.yml need the following config
  13.  
  14. version: '3'
  15. services:
  16. database:
  17. build:
  18. context: ./postgresql
  19. dockerfile: postgresql.Dockerfile
Add Comment
Please, Sign In to add comment