1

How can I copy files that are inside the container so I can edit them?

services:
  web:
    image: jitsi/web
    restart: ${RESTART_POLICY}
    ports:
      - '${HTTP_PORT}:80'
      - '${HTTPS_PORT}:443'
    volumes:
      - ${CONFIG}/web:/config
      - ${CONFIG}/web/letsencrypt:/etc/letsencrypt
      - ${CONFIG}/transcripts:/usr/share/jitsi-meet/transcripts

I want to access the files in the directory /usr/share/jitsi-meet/transcripts within the container:

base.html  connection_optimization  favicon.ico  head.html  index.htmllibs  package-lock.json  plugin.head.html  scripts  static      transcripts
root@cb7d87c5635f:/usr/share/jitsi-meet#
Jeffrey Mixon
  • 12,846
  • 4
  • 32
  • 55
josue
  • 630
  • 1
  • 10
  • 16

1 Answers1

0

You can use docker cp command:

sudo docker cp <containerId>:/path/in/container /path/in/host/

And with the same command, you can copy files backwards from the host machine to the Docker container.

V. Mokrecov
  • 1,014
  • 1
  • 11
  • 20
  • Mount it as a volume. In order to edit it and see the changes in the container – josue Apr 23 '20 at 21:08
  • I'm not sure this is possible in runtime. Why don't you copy the file to the host machine, then edit it and copy it back to the Docker container? – V. Mokrecov Apr 24 '20 at 09:38
  • I also found a discussion here - https://stackoverflow.com/questions/28302178/how-can-i-add-a-volume-to-an-existing-docker-container and a complicated way - https://jpetazzo.github.io/2015/01/13/docker-mount-dynamic-volumes/ I hope this helps you. – V. Mokrecov Apr 24 '20 at 09:50