Skip to content

Instantly share code, notes, and snippets.

@ntedgi
Created February 24, 2019 07:06
Show Gist options
  • Save ntedgi/2fb9aade37f40dbe347214c311914abe to your computer and use it in GitHub Desktop.
Save ntedgi/2fb9aade37f40dbe347214c311914abe to your computer and use it in GitHub Desktop.
Common Docker Commands
docker run <image name> <command>
If image not exist we pull it
Docker run = create + run
The command is override and execute inside the container
* docker image ps
Display all running containers
* docker image ps - - all
Show all running docker ever
If docker exited its not means his dead you can start it again with the start command
* docker create <image-name>
Create the image and return the container ID
* docker start -a <id>
Run and return all the output from the specific container
* docker system prune
Delete all Container cache data
* docker stop <container - id>
Hardware signal send to the hardware used by this container
Let release memory .
If container docent stop in 10 secondes docker kill will send
Send sigterm
* docker kill <container - id>
Send sigkill you have to shot done write now
* docker logs <id>
Get all logs of created <container id>
* docker exec -it <container id> <command>
-it type input exec to the container without it the command want have any chance getting an input and return to the terminal
Flags = [ -it => -i -t ]
[ -i ] rederice input to container stdin
[ -t ] format output of container
* every container as 3 standers input
Stdin -
Stdout -
Stderr -
* docker exec -it <container id> <command> sh
Open a Terminal in a container context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment