List of Top Docker Commands in Linux

Table of Contents
Docker works just like Git.


you have to always take a pull for latest image.


****************************** Docker install ******************

sudo apt-get update
sudo apt-get install docker.io



**************************** Check docker installed or not *************


docker ps -a


************************* Login to AWS container via command line ************


 $(aws ecr get-login –no-include-email –region us-east-1)

get-login
[--registry-ids <value> [<value>...]]
[--include-email | --no-include-email]



**************************** pull the docker image *************


docker pull your-server.us-east-1.amazonaws.com/aws_repository


************************** Docker push image **************************************


-> commit your changes first


docker commit <your-container-name> your-server.us-east-1.amazonaws.com/aws_repository:v2.2 (v2.2 is the tagging  version)


-> Now run push command


docker push your-server.us-east-1.amazonaws.com/aws_repository:v2.2


you can check your latest push on server [aws/ECR/Repository/click on your repository]


*********************************** Create container with in docker *********************


docker run -it –restart always –net=subnet15 –hostname=<your-container-name> –name <your-container-name> your-server.us-east-1.amazonaws.com/aws_repository


**************************** Enter into docker container *************


-> docker exec -it <docker-container-name> bash


-> docker attach <docker-container-name>


****************************** To check docker container *******
-> docker ps


-> su md (switch to md user)


*************************** Check all cron in docker *****
crontab -e


******************** Install library into lib folder ***********************
pip3 install name -t . (within your python library path)


*************************** List Docker CLI commands **************
docker
docker container –help


*************** Display Docker version and info *************
docker –version
docker version
docker info


************ Execute Docker image **********
docker run hello-world


******************* List Docker images ***************
docker image ls


******************* List Docker containers (running, all, all in quiet mode) *****************
docker container ls
docker container ls –all
docker container ls -aq


************************* list docker all container*********************
docker container ls -a

Related posts