Search code examples
dockerfig

How to ADD sibling directory to Docker image


Is there a way to copy a sibling directory into my docker image, i.e., something like

ADD ../sibling_directory /usr/local/src/web/

This is not permitted - according to the Docker documentation, all resources accessible by my Dockerfile must be under the Dockerfile working directory.

In my scenario, I am in the process of splitting out worker services from web services from a common code base, and I'd like to do that logically first without having to actually physically separate the code.


Solution

  • Here's what a potential fig.yml might look like:

    web:
        build: ./web/
        volumes:
         - /usr/local/src/web/
    worker:
        build: ./worker/
        volumes_from:
         - web