(Archived) Docker commands overview

You have tried to access an archived page. Please go to the new https://root360.atlassian.net/wiki/spaces/KB to find more documents.










root360 Container Platform Commands

We newly released a more comprehensive Tool Suite currently beeing in BETA-state. Have a look here!



The following are the CLI Command, which are provided for the analysis of Docker Containers.

They are divided into 2 areas. The docker hosts on which the containers are running, as well as the jump server. The latter serves as a central gateway. It is thus an orientation point for determining which docker host is running which container.



Docker Hosts

The following commands can be called via "sudo":



  • Overview of running containers: docker ps, docker ps -a

  • Overview of existing images: dockerimages, dockerimages -a

  • Analyse von Logs: docker logs [OPTION] CONTAINERID

  • Verbinden zum Docker Container (als root-User im Container!): docker exec -it CONTAINERID bash

Jump-Server

The following commands can be used to get an overview of the distribution of docker containers from the Jump server via the docker hosts of the existing clusters:



  • show-ecs-service-status.py

  •  

    • Which services exist 

    • a deployment is currently in progress for a service

  •  

    • In addition, the Eventlog can be issued to a service (JSON).

  • ecs-instance-list

  •  

    • On which docker host is the container and what is its status (from Amazon ECS perspective)?



sudo show-ecs-service-status.py --help Usage: show-ecs-service-status.py [option] arg Options: -h, --help show this help message and exit -e, --events Show full service event log only. -l, --list-services List available services. -i, --show-image Show ACTIVE image and revision the services running on. -s SERVICE, --service=SERVICE The service for which information should be gathered. -c CSTAT, --container-status=CSTAT Show status of a container.



ecs-instance-list --help /usr/local/bin/ecs-instance-list [cluster1 [cluster2]] This script checks status of AWS ECS container and lists their hosting docker node.



Examples



The  Example 1  shows the deployment status of a service. 

The important points are here:



  • The service is ACTIVE, which means that containers are started in the cluster

  •  

    • "desired" specifies the number of container instances to run as well 

    • "running" indicates how many container instances actually run

    • "pending" indicates how many container instances are still in the start process

  • "deploys" describes existing deployment processes or the current state

  •  

    • status: "PRIMARY" specifies which container revision (" taskDefinition" ) is currently running

    • the service is not "ACTIVE", the new revision is always stored as a PRIMARY during a deployment. A migration process is not necessary in this case.

  • If there is more than one block under "deploys", a migration process is displayed as part of a deployment (rolling update). 

  •  

    • A new revision is set as PRIMARY

    • Reading direction: In a deployment process, the target status is set as PRIMARY and a migration process from the ACTIVE to the PRIMARY is triggered



example 1
sudo show-ecs-service-status.py -s name-of-the-service [ { "status": "ACTIVE", "desired": 1, "running": 1, "taskDefinition": "arn:aws:ecs:eu-west-1:123456789:task-definition/name-of-the-service:30", "deploys": { "status": "PRIMARY", "pendingCount": 0, "desiredCount": 1, "runningCount": 1, "createdAt": 1448643341.737, "updatedAt": 1448643341.737, "id": "ecs-svc/9223370588211434070", "taskDefinition": "arn:aws:ecs:eu-west-1:123456789:task-definition/name-of-the-service:30" }, "pending": 0 } ]



The  Example 2  shows the events to a Deploymentvorgang according to the process description from  Docker containers Deployment

example 2



Example 3  shows an overview of the docker hosts of a cluster and the distribution of the containers on them.

example 3



Example 4  shows the status of a container in detail:

The important points are here:



  • "lastStatus" describes the current status

  • "desiredStatus" describes the target state

  • "stoppedReason": is only to be found with stopped containers and represents in detail the reason for the state.






root360 Knowledge Base - This portal is hosted by Atlassian (atlassian.com | Privacy Policy)