Last active
October 14, 2017 04:28
-
-
Save yogendra/d7dda16f7c6657b5834cdde9309067d3 to your computer and use it in GitHub Desktop.
Docker Helper
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
#!/bin/sh | |
parent=`docker inspect -f '{{ .Parent }}' $1` 2>/dev/null | |
level=${2:-1} | |
echo ${level}: `docker inspect -f '{{ .ContainerConfig.Cmd }}' $1 2>/dev/null` | |
level=$((level+1)) | |
if [ "${parent}" != "" ]; then | |
echo ${level}: $parent | |
$0 $parent $level | |
fi |
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
#!/bin/bash | |
docker history --no-trunc "$1" | \ | |
sed -n -e 's,.*/bin/sh -c #(nop) \(MAINTAINER .*[^ ]\) *0 B,\1,p' | \ | |
head -1 | |
docker inspect --format='{{range $e := .Config.Env}} | |
ENV {{$e}} | |
{{end}}{{range $e,$v := .Config.ExposedPorts}} | |
EXPOSE {{$e}} | |
{{end}}{{range $e,$v := .Config.Volumes}} | |
VOLUME {{$e}} | |
{{end}}{{with .Config.User}}USER {{.}}{{end}} | |
{{with .Config.WorkingDir}}WORKDIR {{.}}{{end}} | |
{{with .Config.Entrypoint}}ENTRYPOINT {{json .}}{{end}} | |
{{with .Config.Cmd}}CMD {{json .}}{{end}} | |
{{with .Config.OnBuild}}ONBUILD {{json .}}{{end}}' "$1" |
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 run --rm -v /var/run/docker.sock:/var/run/docker.sock dduvnjak/dockerfile-from-image yogendra/blog-toolbox:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker history --no-trunc --format '{{.CreatedBy}}' image