This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| virtualization:docker [2022/02/10 15:31] – jotasandoku | virtualization:docker [2023/11/02 14:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| **__DOCKER__**\\ | **__DOCKER__**\\ | ||
| Emulate only the user space. Container engine isolates user spaces. | Emulate only the user space. Container engine isolates user spaces. | ||
| - | * cgroups: kernel mechanism for limiting and measuring the total resources used by a group of processes running on a system. For example, you can apply CPU, memory, network or IO quotas. cgroups | + | |
| - | * namespaces: Namespaces are a kernel mechanism for limiting the visibility that a group of processes has of the rest of a system. For example you can limit visibility to certain process trees, | + | |
| Tutorial, all [[https:// | Tutorial, all [[https:// | ||
| - | The principle of docker is we start a container to __Run a Task__. If there' | + | The principle of docker is we start a container to __Run a Task__. If there' |
| ---- | ---- | ||
| RUN container: | RUN container: | ||
| - | docker run -it --rm --name C2 {image-name} / | + | docker run -it --rm --name C2 {image-name-eg-busybox} / |
| docker run --rm -v /foo -v awesome:/ | docker run --rm -v /foo -v awesome:/ | ||
| cat / | cat / | ||
| Line 25: | Line 25: | ||
| docker stop f51e9de57784 | docker stop f51e9de57784 | ||
| docker restart < | docker restart < | ||
| + | docker run -itd --name c3 busybox | ||
| + | docker run -it --name c2 busybox | ||
| docker exec -it "id of running container" | docker exec -it "id of running container" | ||
| | | ||
| + | Remove all running and exited container (USER WITH CARE!): | ||
| + | docker container kill $(docker ps -q) | ||
| + | docker rm $(docker ps -a -f status=exited -q) | ||
| + | |||
| To list containers, stop them , get logs etc, | To list containers, stop them , get logs etc, | ||
| | | ||
| Line 61: | Line 67: | ||
| docker rmi [image name or ID] | docker rmi [image name or ID] | ||
| - | With cli access | + | '' |
| docker run -it ubuntu # start and connect to shell | docker run -it ubuntu # start and connect to shell | ||
| docker inspect 25b4bff1417c | jq . # to check the instance params without having to connect to it | docker inspect 25b4bff1417c | jq . # to check the instance params without having to connect to it | ||
| Line 80: | Line 86: | ||
| ---- | ---- | ||
| - | DOCKER | + | __**DOCKER |
| * driver: | * driver: | ||
| * host | * host | ||
| Line 88: | Line 94: | ||
| * veth0,1.. | * veth0,1.. | ||
| - | | + | |
| + | docker run -itd --rm --name C1 --network=br0 busybox | ||
| [[https:// | [[https:// | ||
| Line 96: | Line 103: | ||
| - | |||
| - | ---- | ||
| - | |||
| - | **__DOCKER NETWORKING__**: | ||
| __IPV6__\\ | __IPV6__\\ | ||