常见命令
从镜像创建并运行新容器
docker run -d
通过 docker-compose.yaml 启动镜像
docker compose up -d
docker-compose up -d
在正在运行的容器中执行命令
docker exec -it [容器] /bin/sh
docker exec -it [容器] /bin/bash
列出容器
docker ps
从Dockerfile构建映像
docker build -t [Dockername]:latest .
从文件烘焙构建
docker buildx bake
从注册表下载图像
docker pull nginx
pull Download an image from a registry
push Upload an image to a registry
images List images
login Authenticate to a registry
logout Log out from a registry
search Search Docker Hub for images
version Show the Docker version information
info Display system-wide information
创建网络
docker network create my-network
停止容器
docker stop 容器ID或名称
文件名称
docker-compose.yaml