You can run the commands in your terminal in old way or new way. Output will remain same. They were changed because as the list of sub-commands grew, the team at docker determined that it would be best to allow users to specify which section of the docker command the user was going to use. So because the sub-command list grew as in docker network create, or docker volume ls, they wanted to specify docker container stop instead of solely docker stop. The last two do the same thing, but in order to keep uniformity of docker <subcommand> argument where subcommand is the area in docker you want to control, and argument is what you want to do with it.
To Check other parts of this series:-
Part 1
Part 2
Part 3
Part 4
Part 5
Part 6
Part 7
To Check other parts of this series:-
Part 1
Part 2
Part 3
Part 4
Part 5
Part 6
Part 7
Command
Meaning
|
Old
Way to Run Docker Commands
|
New
Way to Run Docker Commands
|
To
Run a Container
|
Docker
run
|
Docker
container run
|
To
Exit and Stop a Container
|
Ctrl + c (If
running only in windows then docker stop is needed to stop a container)
|
Ctrl + c (If
running only in windows then docker stop is needed to stop a container)
|
To
list running containers
|
Docker
ps
|
Docker
container ls
|
To
stop the container process but doesn’t remove it
|
Docker stop
<container id>
|
Docker container
stop <container id>
|
To
list all containers created till date
|
Docker
ps --all
|
Docker
container ls --all
|
To
Start stopped container
|
Docker start <container
id>
|
Docker container
start <container id>
|
To
get the logs from the container
|
Docker
logs <container id>
|
Docker
container logs <container id>
|
To
check top processes running inside the containers
|
Docker top <container
id>
|
Docker container
top <container id>
|
To
Remove one or more containers
|
Docker
rm <container id 1> <container id 2> …..
|
Docker
container rm <container id 1> <container id 2> …..
|
To
forcefully remove one or more running containers
|
Docker rm -f <container
id 1> <container id 2> …..
|
Docker container
rm -f <container id 1> <container id 2> …..
|
No comments:
Post a Comment