-
-
Save derFunk/7a58fe9d538035f94d6cb6826e8b25e1 to your computer and use it in GitHub Desktop.
generate docker-compose.yml by inspecting a running container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-yml() { | |
docker inspect -f $' | |
version: '2.2' | |
services: | |
{{.Name}} | |
image: {{.Config.Image}} | |
entrypoint: {{json .Config.Entrypoint}} | |
command: {{json .Config.Cmd}} | |
environment: {{range .Config.Env}} | |
- {{.}}{{end}} | |
volumes: {{range .Mounts}} | |
- {{.Name}}:{{.Destination}}{{end}} | |
' $1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment