-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker ps --fitler 'name=^/...$
(leading slash in container name) does not work with Podman macOS helper
#16663
Comments
Thanks for reaching out, @Frederick888! I can reproduce with the "local" binary on Linux as well. Do you know what this slash is intended for? It doesn't look like a regular expression to me. |
I think the want to have a container named |
Don't think that's possible, the name regex doesn't allow / as a character
…On Mon, Dec 12, 2022 at 3:08 PM Daniel J Walsh ***@***.***> wrote:
I think the want to have a container named /foo So it is not part of the
regular expression.
—
Reply to this email directly, view it on GitHub
<#16663 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3AOCE4XPTENF77TVT4ZELWM6A3PANCNFSM6AAAAAASOCXHFQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Looks like it is legal with Docker.
|
Docker seems to allow the names to start with "/"
|
Looks like this was introduced in moby/moby#2162 (moby/moby@256b753 to be specific). After skimming through the PR, I guess it represents some sort of namespace, and a leading And not only does it allow container names to have a leading slash, it also makes sure # start a container without a leading slash in name explicitly
$ docker run --rm -it --name arch archlinux bash
# I can use a regex with the slash
$ docker ps --filter 'name=^/arch$'
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
713399f8ab17 archlinux "bash" 30 seconds ago Up 29 seconds arch
# or without
$ docker ps --filter 'name=^arch$'
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
713399f8ab17 archlinux "bash" 48 seconds ago Up 47 seconds arch
# same results if I use --name /arch to start the container The name from # Docker Linux
$ docker container inspect arch --format {{.Name}}
/arch
# Docker CLI macOS + Podman
$ podman run --rm -it --name arch archlinux bash
$ docker container inspect arch --format {{.Name}}
/arch
$ podman container inspect arch --format {{.Name}}
arch |
And as expected: # Docker Linux
$ docker run --rm -it --name /arch archlinux bash
$ docker run --rm -it --name arch archlinux bash
docker: Error response from daemon: Conflict. The container name "/arch" is already in use by container "436c07d4a7af53d899228d5f2831b9ec0881f211c3ebc7a72ac855db7bb3f50d". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'. |
Fixes: containers#16663 Signed-off-by: Daniel J Walsh <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Steps to reproduce the issue:
docker run --rm -it --name foo archlinux:latest bash
docker ps --filter 'name=^/foo$
Describe the results you received:
No container listed (despite that
docker container inspect foo --format {{.Name}}
has a leading slash.)Describe the results you expected:
Both
docker ps --filter 'name=^/foo$
anddocker ps --filter 'name=^foo$
work like Docker (confirmed with both macOS Docker Desktop and Docker Linux).Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:(Podman 4.3.1 hasn't hit CoreOS yet.)
Output of
podman info
:Package info (e.g. output of
rpm -q podman
orapt list podman
orbrew info podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
# in macOS $ docker --version Docker version 20.10.21, build baeda1f
The text was updated successfully, but these errors were encountered: