Docker Community Forums

Share and learn in the Docker community.

Error executing command with docker run

Hello!

I am having an issue executing this command docker run alpine cat /etc/*release* on my macOS 10.13.1.

I get a response of zsh: no matches found: /etc/*release*

When I use online playgrounds like katacoda to try the command, it works fine.

What could be wrong on my side please?

any help please? I have done so much googling to no success.

When you run that command, zsh tries to expand /etc/*release* itself instead of passing it to the command to be executed in docker. So it actually tries to look up /etc/*release* in your local MacOS installation and fails to find it, leading to that error message.
What you should actually do is run:

docker run alpine /bin/sh -c "cat /etc/*release*"
2 Likes

Thank you Johan.

This explains it, however, alpine uses ash for its bash so the updated command that worked is

docker run alpine /bin/ash -c “cat /etc/*release*”

No, it doesn’t :wink:

% docker run -it --rm alpine
/ # ls -l /bin/sh /bin/ash
lrwxrwxrwx    1 root     root            12 Jan 16 21:52 /bin/ash -> /bin/busybox
lrwxrwxrwx    1 root     root            12 Jan 16 21:52 /bin/sh -> /bin/busybox

Glad I could be of help.

I actually arrived here after googling the issue. Thanks. I’m trying to make sense of this command by checking the documentation. It’s not the easiest to make sense of. Any chance you can explain what the command is actually doing?

Thanks either way!