Docker containers are made of layers
- if the layers of image are same, then not all layers will be downloaded

Docker create creates the container while docker run is combination of creating and starting container. Docker run creates a new container while docker start starts the existing one.
-druns the container in the background
By default docker run attach to the running container and it’s not interactive.
To build a image, usedocker build -t the-image-name:tag .and . is the folder where the Dockerfile is.
To access a terminal from running container usedocker exec -it name bashto interactively access the terminal.
During docker volume bind mount, docker will default to creating a directory in bind mount, this is true if bind mounting a file that does not exist on the host
docker tagcommand rename docker images, when pushing to dockerhub, if user says latest, it will default to the newest version
Docker Logs
Moved to docker-logs
Use docker inspect | jq .[].Keys to parse the json data of a given container
.[].HostConfiggeneral configuration of container.[].HostConfig.Bindsto check volume bindings.[].Mountsshows all the volumes.[].NetworkSettingscheck the network settings for example port map.[].NetworkSettings.Portsshows the exposed ports.[].Config.Envshows all the environment variables.[].State.Statusget the status of running container eg.exitedrunning
Docker ps-qwill only show the ID of a image which is useful to pipe into xargs--filtercan filter based on conditions, such as names, status=exitedexpose=1000-2000/tcpfilter shows all the containers with port 1000-2000 exposed-sget the size a container takes on disk
Docker Stats
- docker stats give the CPU usage statistics
- docker top give list of running processes of a given container
Docker Exec
-imakes the session interactive-tTTY terminal from container in this host- this is similar to docker attach, which attach to the running process of the docker container
Pushing to DockerHub
- login to dockerhub first
- use
docker tagto rename the image with docker username vttc08/my-image:0.0.0docker push