docker 导出yaml文件
参考地址放在最前面
# 两种方式:
https://github.com/Red5d/docker-autocompose
https://github.com/tenfyzhong/dctc
docker-autocompose
#获取docker autocompose的镜像
docker pull ghcr.io/red5d/docker-autocompose:latest
#将容器ID 21beb05f14bb 导出yaml格式的配置
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose 21beb05f14bb
#将yaml配置写到文件里
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose 21beb05f14bb > docker-compose.yaml
dctc
#因国内网络问题,go download时可能会失败
go get -u github.com/tenfyzhong/dctc
go install github.com/tenfyzhong/dctc
dctc 容器名或id -o docker-compose.yaml
网友评论