Docker Community Forums

Share and learn in the Docker community.

Moving volume between containers docker-composer


(Jeroendebeer) #1

I have image A (some_laravel_project) and B (laravel_module). Image A is a Laravel project that looks like this.

  • app
  • modules
    • core
    • Volume Image b here
  • config

As the list above suggests I want to share a volume from Image B in Image A using docker-compose. I want to access the files in container B.

This is the docker-compose I tried and didn’t receive any errors creating those images in gitlab ci. I checked and the volume and its files are in stored in the module_user:latest container.

I think I made a mistake mounting the volume to some_laravel_project.

version: '3'
services:
    laravel:
        image: some_laravel_project
        working_dir: /var/www
        volumes:
          - /var/www/storage
          - userdata:/var/www/Modules

    user:
        image: laravel_module
        volumes:
          - userdata:/user
volumes:
    userdata:
    webroot: