Skip to content

Instantly share code, notes, and snippets.

@b333z
Forked from derFunk/generate-compose.sh
Created December 27, 2017 10:48
Show Gist options
  • Save b333z/2be62335bea5ab159926a50a663e5a0e to your computer and use it in GitHub Desktop.
Save b333z/2be62335bea5ab159926a50a663e5a0e to your computer and use it in GitHub Desktop.
generate docker-compose.yml by inspecting a running container
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