Город МОСКОВСКИЙ
00:04:10

Get container name from a docker swarm stack

Аватар
JavaScript и машинное обучение
Просмотры:
26
Дата загрузки:
03.12.2023 10:54
Длительность:
00:04:10
Категория:
Технологии и интернет

Описание

In this demo, I will get a container name to inspect or check the logs

1- Get Services of a specific stack
docker stack services mongo-express

2- Get the running tasks of this service
docker service ps mongo-express_mongo-express --filter 'desired-state=Running' --no-trunc --format 'table{{.ID}}\t{{.Name}}\t{{.Node}}'

3- Log in to the node where the task is running
4- Get the container name
the container name will be named in this format:

CONTAINER NAME = TASK NAME + '.' + TASK ID

5- Verify container name
docker ps -a --format 'table{{.ID}}\t{{.Names}}'

Рекомендуемые видео