-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands_notes.txt
58 lines (41 loc) · 2.31 KB
/
commands_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using modern linux kernel we can isolate any process from others and make that process believe it has its own vm when really it doesn't and that includes isolating filesystems, network interfaces, memory resource access the whole thing
-------------------commands-------------------
- images
docker images
docker rmi [image id or name]
docker pull
docker inspect [image]
- containers
https://linuxhandbook.com/list-containers-docker/
https://linuxhandbook.com/essential-docker-commands/
https://linuxhandbook.com/docker-ps-command/#:~:text=%20The%20docker%20ps%20command%20%201%20Show,deal%20with%20Container%20IDs%20so%20you...%20More%20
docker ps (shows running containers)
docker ps -a (shows all containers running/not running)
docker run
docker start
docker stop
docker rm [container id]
docker top [id/name] -> shows top processes
docker stats [id/name of container] -> shows stats of container
docker start -a [id/name] (starts an already created container and we also enter it cause of -a flag)
we can connect to that container in another shell using docker attach [id]
why -t flag in docker run
https://stackoverflow.com/questions/30137135/confused-about-docker-t-option-to-allocate-a-pseudo-tty
difference between attach and exec
https://stackoverflow.com/questions/30960686/difference-between-docker-attach-and-docker-exec
NOTE: docker run is to create new container
while creating we can specify few things about container eg -p -d --name etc
but in start we don't have them, we just do docker start [id] and container will have all those things we gave it during creating it using docker run
- system
docker stats
docker system df
docker system prune
------------------- more on images -------------------
docker run ubuntu
- this command creates an ubuntu container, tho the container is created, it is not running!
- to go inside and run the container, we can see details in docker hub details for that image
in this case, docker run -it ubuntu runs the container + we go inside it
NOTE: why does "docker start [id of container]" not work to run the container after it was created using docker run image?
https://stackoverflow.com/questions/29599632/docker-container-is-not-running
docker rm $(docker ps -a -q) (deletes all stopped containers)
docker rm $(docker images -q) (deletes all the images that are not used)