Docker commands for new Devops Engineers

Docker basic commands for beginners:

  • dicker ps
    • To see running docker processes.

 

  • docker ps -a
    • To see all the docker processes, including stopped ones.

 

  • docker exec -it czcmysql /bin/bash
    • To login into particular container, here czcmysql is mysql’s container name, you can also use container id instead of name to login.

 

  • docker image ls
    • List all docker images.

 

  • docker container ls
    • List all docker containers.

 

  • sudo docker start czcbackend
    • To start a particular docker container, here czcbackend is my container’s name.

 

  • sudo docker stop czcbackend
    • To stop a particular docker container, here czcbackend is my container’s name.

 

  • sudo docker restart czcjenkins
    • To restart a particular docker container, here czcjenkins is my jenkins container name.

 

  • sudo docker logs czcbackend
    • To see the logs details of a particular docker container, here czcbackend is my container’s name.

 

  • sudo docker rm d724fc6c512c31585bfeebccce1196df09cdc3c9152f01eb627aa3c198982c09
    • Removing docker container

 

  • sudo docker inspect container_id
    • Gives detailed information about the container.

 

  • sudo docker cp callmeuissr.sh czcjenkins:/var/jenkins_home/script/
    • This copies the callmeuissr.sh file from your current linux machine location to your docker container named czcjenkins and in this path /var/jenkins_home/script.

 

  • docker container exec -u 0 -it czcjenkins bash
    • This command can be used something similar to this functionality, (getting into container called czcjenkins (for jenkins) and update the war file(jenkins docker container update)).
    • If you are looking for the complete docker jenkins update details, then this medium post can help you.

 

This can be verified by proceeding the below way:

  1. sudo docker exec -it czcjenkins /bin/bash (getting into czcjenkins docker container)
  2. cd /var/jenkins_home/script (going into the pasted path)
  3. ls (will show the list along with your copied file callmeuissr.sh file)

232 total views, 2 views today

About: Mirthbees

Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in