Skip to content

Latest commit

 

History

History
78 lines (62 loc) · 1.51 KB

docker_containers.md

File metadata and controls

78 lines (62 loc) · 1.51 KB

What are Containers?

Running instances of images.

Features

  1. Very light weight (less resources are used)
  2. Booting of container is very fase
  3. can easily, start, stop and kill a container.

COMMANDS

docker run --name MyUbuntu1 -it ubuntu

Usage - will run a image and give it name as well.

docker pause MyUbuntu1

(docker pause <Container Id | name>)

Usage - It will basically pause the container. (Even if you type something, it wont show)

docker unpause MyUbuntu1

Usage - It will run all the commands which were executed after the container was stopped.

docker top <container name | id>

Usage - Display the running processes of a container.

docker stats <container name | id>

Usage - Will display a live stream of container resource usage stats.

docker attach <container name | id>

Usage - will attach to a running container. (if you exit, all the other terminals where this container is being run will also be exited).

can be used in this way as well

docker start MyUbuntu1
docker attach MyUbuntu1

or

docker start RahulUbuntu -i
docker kill RahulUbuntu

Usage - Kill one or more running containers.

docker rm MyUbuntu1

Usage - Remove a container. (add -f to remove a running container)

docker history ubuntu

Usage - Will show history of the image