sudo docker ps -a
sudo docker images
sudo docker-compose build 
sudo docker-compose up -d --build
sudo docker exec -it nginx /bin/sh

删除容器

sudo docker compose start  restart logs
sudo docker compose down --rmi all
sudo docker rmi hello-world
sudo docker compose down -v
sudo docker compose rm -f
sudo docker system prune -a

转移

sudo systemctl stop docker docker.socket
sudo mkdir -p /nas/docker-data
sudo rsync -avzh /var/lib/docker/ /nas/docker-data/

软连接:https://developer.aliyun.com/article/785312

或者重新安装,配置/etc/docker/daemon.json (新版本)为

{
    "data-root": "/store/software/docker",
    "storage-driver": "overlay2" # 这个是 Docker 是默认设置,这里也可以不用加
}

验证:

sudo docker info | grep "Docker Root Dir"
sudo docker info | grep "Storage Driver"
sudo docker run hello-world

设置default volums path

如何配置生成镜像image?