Advertisement
Guest User

Restore dockerfile script

a guest
Aug 19th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.56 KB | None | 0 0
  1. #!/bin/bash
  2. docker history --no-trunc "$1" | \
  3. sed -n -e 's,.*/bin/sh -c #(nop) \(MAINTAINER .*[^ ]\) *0 B,\1,p' | \
  4. head -1
  5. docker inspect --format='{{range $e := .Config.Env}}
  6. ENV {{$e}}
  7. {{end}}{{range $e,$v := .Config.ExposedPorts}}
  8. EXPOSE {{$e}}
  9. {{end}}{{range $e,$v := .Config.Volumes}}
  10. VOLUME {{$e}}
  11. {{end}}{{with .Config.User}}USER {{.}}{{end}}
  12. {{with .Config.WorkingDir}}WORKDIR {{.}}{{end}}
  13. {{with .Config.Entrypoint}}ENTRYPOINT {{json .}}{{end}}
  14. {{with .Config.Cmd}}CMD {{json .}}{{end}}
  15. {{with .Config.OnBuild}}ONBUILD {{json .}}{{end}}' "$1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement