Sunday, June 11, 2017

Docker commands

Docker cli commands


commanddocker images  
Provides Image Tag name ,Image     id,date created and size

To identify,what containers running on the server:

command

docker ps
ProvidesContainerid,Ports,Names,date created,Status of container
How to start/stop and remove the container:
ModeDescriptioncommand
StartAfter deploying the container in to the box, it is specified with the help of ID(that is the container id)docker start containerid
StopIf you want to remove/stop the container you have to do this stop command ,before removing the container.docker stop containerid
removeto remove the containerdocker rm containerid
Note:Inside the box, we have always two containers running,but one container,please make sure at any cost Ecs-agent container /image should not be removed.



Execute an interactive bash shell on the container:
commandDescription
docker exec -it containerid /bin/bash
which provides all the information related to the application and other basic stuff and help us to view the container through bash shell.
Please ensure that,when you use the above command,the docker container should be in running state.


Troubleshooting and logs

Application logs
Commanddocker logs containerid
ProvidesThe status of the application that we are running on the container.
ECS logs 
Directory Path var/log/ecs 
ProvidesTaskdefinition name & number
Task information
Image information with Tag name


Directory Path/var/lib/ecs/data
(complete information in the JSON format).
Providescontainer definition metrics
(Image,Port,version,NODE_ENV
the complete stuff used for the container to build).

Docker logs
Directory Path/var/lib/docker
ProvidesImage,container,network,overlay,tmp,volumes and storage drivers.

To know the ipaddress of a specific container:
docker inspect container name | grep '"IPAddress"' | head -n

This is another way to copy files into an image. The -v option temporarily creates a volume that us used during the build process.

docker build -t  {image name }   -v  {host directory} : {temp build directory}   .


No comments:

Post a Comment