How to get a full id of a certain container

Dear all,
If I have a container running in docker named "test"
how do I get the full ID of this container?

I know the command of

$ docker ps -a --no-trunc -q"

but this will show all of my containers ID.

Hi,

You could pipe the output and grep for the short ID of your container:

vagrant@dockertest:~$ docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED              STATUS              PORTS               NAMES
ad6d5d32576a        nginx:latest        "nginx -g 'daemon of   About a minute ago   Up About a minute   80/tcp, 443/tcp     nostalgic_sammet
9bab1a42d6a9        nginx:latest        "nginx -g 'daemon of   About a minute ago   Up About a minute   80/tcp, 443/tcp     mad_kowalevski
beb70a6a2426        nginx:latest        "nginx -g 'daemon of   3 minutes ago        Up 3 minutes        80/tcp, 443/tcp     admiring_franklin
vagrant@dockertest:~$ docker ps -q --no-trunc | grep ad6d5d32576a
ad6d5d32576ad3cb1fcaa59b564b8f6f22b079631080ab1a3bbac9199953eb7d
1 Like

I think you want

$ docker inspect --format="{{.Id}}" evil_swartz
756535dc6e9ab9b560f84c85063f55952273a23192641fc2756aa9721d9d1000
6 Likes

Indeed! Thank you!
This is exactly what I need