Skip to content

Docker命令

查找容器的IP地址

shell
## 单个容器
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my_container

## 遍历全部容器
docker inspect -f '{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -a -q)

show command for each docker

sh
docker inspect -f "{{.Name}} {{.Path}} {{.Args}}" $(docker ps -a -q)

迁移默认的docker数据位置

shell
sudo systemctl stop docker

sudo vim /etc/docker/daemon.json # 以下内容

{
    "data-root": "/data/docker"
}


sudo systemctl start docker
sudo systemctl status docker

Released under the MIT License.