Mount a host directory as a data volume

From Do you speak Drupalish? Featured Drupal wiki-like documentation
Jump to: navigation, search
  • First docker copy from container to host ( after install)
    • or docker export and copy from backup ( prefer after install servers ex: pgsql)
  • https://docs.docker.com/engine/userguide/containers/dockervolumes/#mount-a-host-directory-as-a-data-volume
    • This command mounts the host directory, /src/webapp, into the container at /opt/webapp. țțțIf the path /opt/webapp already exists inside the container’s image, the /src/webapp mount overlays but does not remove the pre-existing content. Once the mount is removed, the content is accessible again. This is consistent with the expected behavior of the mount command.
    • I don't have to delete the initial content.

Security

  • Because of limitations in the mount function, moving subdirectories within the host’s source directory can give access from the container to the host’s file system. This requires a malicious user with access to host and its mounted directory.

Don't

  • move or modify the files directy in host ( only via docker)