What & Why?
- 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 (tools, config, code,…)
Abbreviate
ps= process status: check running container (withaargument to show all)
i= interactive: used indocker execordocker run
t= terminal: used indocker execordocker run
m= memory
v= volume: mount volume in/out containers
-rm= remove: create temporary a container (will be removed after exits)
Installation
- Client: OrbStack, official apps.
OrbStack supports
container.orb.local which points to the local server. It also supports logs, debugging and opening a terminal inside the container.References
- Play with Docker - right on the web
General
1# docker's version
2docker --version
3
4# Remove any resources
5docker system prune
6
7# where're images stored?
8docker info # normally: /var/lib/docker
9Images
1# Build image with Dockerfile
2docker buildx build -t v2daimg .
3# docker build -t <img_name> .
4# image name must be in lowercase
5# run again to update the build
6
7# Set target platform for build
8docker buildx build -t v2daimg --platform=linux/amd64 .
9
10# To know the host platform within a running container
11docker run --rm <image_name> uname -m
12# eg: aarch64
13
14# don't use the cached layer from previous build
15docker build --no-cache -t img_name .
16
17# Custom Dockerfile.abc
18docker build -t <img_name> . -f Dockerfile.abc1# ram & cpu usages
2docker stats
3docker stats <container_name|container_id>
4
5# get ip address
6docker inspect <container_name|container_id> | grep IPAddress
7
8# check image's info
9docker inspect <image_id>- More about
--platform