Last active
November 18, 2022 08:37
-
-
Save samundrak/dd1fd41d45fe792d84994b6c8c42094a to your computer and use it in GitHub Desktop.
Handy Lists of docker commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### Pull repo from Docker hub | |
`docker pull <image>` | |
##### List Docker images | |
`docker images` | |
##### List Docker running containers | |
`docker ps` | |
##### List all docker running and non running containers | |
`docker ps -a` | |
##### Run a image as container | |
`docker run -it <image>:<tag> [/bin/bash]` | |
* -d for daemon | |
* --name for name | |
* -p to expose port | |
##### Stop docker container gracefully | |
`docker stop <container id|name>` | |
##### Start docker container | |
`docker start <container id>` | |
##### kill container immediately | |
`docker kill <container id>` | |
##### Output logs from docker container proxying stdout | |
` docker logs <container id>` | |
##### exec command on docker container | |
`docker exec -it /bin/bash` | |
###### Search images in docker hub | |
`docker search <search term>` | |
###### change the name that has been randomly generated for the container | |
`docker rename <current_container_name> <new_container_name>` | |
###### take a peek inside our containers | |
` docker stats <container_name>` | |
###### list of all running processes inside the container | |
` docker top <container_name>` | |
###### Remove container | |
`docker rm <container>` | |
* -v to remove with volume | |
###### Remove image | |
` docker rmi <image>` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment