- Docker is an open source virtualization technology that makes it easy to build, test and deploy applications.
- You can ship your applications in a container environment that houses everything your application need to run (configuration, code,…)
ps= process status: check running containers (withafor all)i= interactive: used indocker execordocker runt= terminal: used indocker execordocker runm= memoryvor-volume: mount volume in/out containers-rm= remove: create temprarily a container (removed after exit)
For all platform, please check the official guide
P/S: On MacOS I recommend using Orbstack that is native MacOS and free for Personally uses. It’s really light, fast and simple way to use Linux Machines.
Got permission denied while trying to connect to the Docker daemon socket- Create the docker group:
sudo groupadd docker - Create the docker group:
sudo usermod -aG docker ${USER} - Logout and login again Source:https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket
- Create the docker group:
Another application changed your Desktop configurations- Create symlink for docker-credential-ecr-login: `sudo ln -sf /Applications/Docker.app/Contents/Resources/bin/docker-credential-ecr-login /usr/local/bin/docker-credential-ecr-login Source: https://github.com/docker/for-mac/issues/7109
Multi-column
Images
# list images on the hostdocker images# check image's infodocker inspect <image_id># where are images stored?docker info# normally: /var/lib/dockerContainer
# list running containerdocker psdocker ps -a # all (include stopped)# check logdocker container logs <container_id># get ip addressdocker inspect <container_id> | grep IPAddress# ram & cpu usagesdocker statsdocker stats <container_name|container_id>
# get ip addressdocker inspect <container_name|container_id> | grep IPAddressWe can use sometimes interchangeable between <container_id> and <container_name>.
# start containerdocker start <container_name|container_id># start and enter the containerdocker start -d <container># stop containerdocker stop <container_name|container_id>
# stop all containerdocker stop ${docker ps -a -q}# entering the running container (no attach)docker exec -it <container_name|container_id> /bin/bash