How to extract container id and container name from 'docker ps -a' result

Hello,

I was wondering if there is any way to catch both container ID and container Name from the the result of ‘docker ps -a’ provided it outputs only one container details as a result. And i am running this command from Jenkins shell.

and also,

i have a volume sitting in the swarm ‘media-volume’. And i want mount a specific folder of that volume for container during start up.

for eg:

docker run -d -v media-volume/specific-folder:/path/inside/container

apologies if this is duplicate. please point me to the original thread if there is any.

TIA :slight_smile: