Can we use regex in docker COPY?

Im trying to copy a file with below format


> database-20.2.1.zip

and i was trying to do

COPY database-+([0-9]).+([0-9]).+([0-9]).zip /docker-entrypoint-initdb.d/database.zip

This gives an error. Is it possible to do this in docker copy ?

Dockerfile COPY

You can use some wildcards but I don’t see parenthesis in the specification.

Each <src> may contain wildcards and matching will be done using Go’s filepath.Match rules.

1 Like