In a docker-compose.yml file, I have an entrypoint which should copy files to a bind mount so that I can retrieve them from the host:
version: '3.9'
services:
my-service:
....
entrypoint: cp /foo/*.txt /data
volumes:
- ./data:/data
But each time I run this container, the log says: cp: cannot stat '/foo/*.txt': No such file or directory. On the other hand, if I enter a full file name, it works very well.
I also tried: entrypoint: ['cp', '/foo/*.txt', '/data'] but the same error occurs.
Ref: https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact
How could I use a wildcard for copying files in my compose service?
Info:
docker --version
Docker version 20.10.21, build baeda1f
cat /etc/lsb-release | grep DESCRIPTION
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"