User Tools

Site Tools


virtualization:docker

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
virtualization:docker [2022/02/10 17:10] jotasandokuvirtualization: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 +  * **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, network interfaces..+  * **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 manage **network stack** in different namespaces.
  
  
 Tutorial, all [[https://container.training/intro-fullday.yml.html#65|HERE]]\\ Tutorial, all [[https://container.training/intro-fullday.yml.html#65|HERE]]\\
-The principle of docker is we start a container to __Run a Task__. If there's no task to run, the container just __stops and exists__.\\+The principle of docker is we start a container to __Run a Task__. If there's no task to run, the container just __stops and exits__.\\
  
  
 ---- ----
 RUN container:  RUN container: 
-  docker run -it --rm  --name C2 {image-name} /bin/bash   # 'it' for INTERACTIVE, rm to clean up the container and remove the file system when the container exits+  docker run -it --rm  --name C2 {image-name-eg-busybox} /bin/bash   # 'it' for INTERACTIVE, rm to clean up the container and remove the file system when the container exits
   docker run --rm -v /foo -v awesome:/bar busybox top  # to mount a local storage filesystem ( uses 'union' daemon to mount it )   docker run --rm -v /foo -v awesome:/bar busybox top  # to mount a local storage filesystem ( uses 'union' daemon to mount it )
   cat /proc/1/cpuset # to Tell if I'm in a container or not   cat /proc/1/cpuset # to Tell if I'm in a container or not
Line 25: Line 25:
   docker stop f51e9de57784     # list containers with ps -a   docker stop f51e9de57784     # list containers with ps -a
   docker restart <container-id/name>   # restart   docker restart <container-id/name>   # restart
 +  docker run -itd --name c3 busybox    # start container daemon mode
 +  docker run -it --name c2 busybox    # start container interactive mode
   docker exec -it "id of running container" bash # connect running container   docker exec -it "id of running container" bash # connect 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,[[https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf|**check this link**]] To list containers, stop them , get logs etc,[[https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf|**check this link**]]
      
virtualization/docker.1644513009.txt.gz · Last modified: (external edit)