Docker installation Details
- Docker when installed on a linux machine creates a group called as
dockergroup. - docker client communicates with docker server (docker daemon) on the unix socket which is accessible only to the users of docker group.
- So after installation add your user to docker group
sudo usermod -aG docker <user-name>
# exit
# relogin
* Now get the docker information docker info to see both client and server details
Running our first container
- To run the docker container we need docker image (which has all the necessary stuff packaged to run the application)
- Steps
- docker contianer run is issued from client
- docker daemon checks in the local image store
- if not present downloads from registry (docker hub)
- runs the container
- To view the images in docker local store
docker image ls
Getting used to docker commands
- Two ways
- help. use
--help - cheatsheet
- help. use
Figure out docker commands
- create a docker network
docker network create - list docker volumes
docker volume ls - stop the docker container
- remove the docker image
- build the docker image
- start all the containers using docker compose
- stop all the containers docker compose
What is present in docker image and how containers are created
- To understand this we need to understand
- cgroups: These put restrictions (256 MB of RAM 1 vcpu)
- namespaces: This creates virtual isolated
- process trees
- mounts
- users
- network interfaces
