docker COPY with file globbing

Inside the dockerfile, I want to specify a copy operation for files which are defined by globbing and I want it to be copied with the path as well. So, something like this:

COPY ./src/**/project.json /app/**/

Considering I have the following structure:

  • Does “ports” on docker-compose.yml have the same effect as EXPOSE on Dockerfile?
  • why does docker have docker volumes and volume containers
  • create a pure data image in docker
  • Starting fig process with supervisor
  • How do I delete a docker image from docker hub via command line?
  • Openshift Job container image from internal registry
  • ./src/bar/project.json

    The destination should look like this:


    but apparently, this doesn’t work and I really don’t want to specify all of the COPY operations separately if I have a chance. Any idea how to do this?

    Note that I cannot basically ignore other files through .dockerignore as suggested as I am going to copy the other files from the same folder after ruining a package install operation. So, the dockerfile is similar to this:

    FROM microsoft/aspnet:1.0.0-rc1-update1
    COPY ./src/**/project.json /app/**/
    WORKDIR /app/ModernShopping.Auth
    RUN ["dnu", "restore"]
    ADD ./src /app
    EXPOSE 44300
    ENTRYPOINT ["dnx", "web"]

  • docker client (docker 1.12/centos) http: server gave HTTP response to HTTPS client
  • How to know whether a layer exists locally on docker 1.10+
  • docker(Mac/Windows): how to access host machine service from the container?
  • docker client daemon access remote swarm `1.12.1` manager
  • Docker - only image with operating system?
  • jenkins multibranch project does not start container as slave
  • 2 Solutions collect form web for “docker COPY with file globbing”

    For any non-standard build operation, I prefer wrapping the docker build command in a script (named ‘build‘).
    Here I would

    • create a subfolder tmp (just beside the Dockerfile, in order to keep it in the docker build context)
    • make the shell cp with globing: cp ./src/**/project.json tmp
    • call docker build, with a Dockerfile including COPY tmp/ /app/
    • deleting tmp.

    That way, I pre-configure what I need from host, before building the image from the host context.



    COPY src/ /app/


    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.