How do we see full commands in the third column (CREATED BY) in the output of docker history command?
$ docker history docker.company.net/docker-base-images/image:1.0 IMAGE CREATED CREATED BY SIZE c0bddf343fc6 7 days ago /bin/sh -c #(nop) LABEL com.company.build.r… 0B <missing> 7 days ago /bin/sh -c #(nop) ARG commit 0B <missing> 7 days ago /bin/sh -c #(nop) ARG date 0B <missing> 7 days ago /bin/sh -c #(nop) ARG repo 0B <missing> 7 days ago /bin/sh -c #(nop) ARG org 0B <missing> 7 days ago /bin/sh -c #(nop) ARG version 0B <missing> 7 days ago /bin/sh -c #(nop) USER [company] 0B <missing> 7 days ago /bin/sh -c apk --no-cache add openjdk8-jre-b… 72.2MB <missing> 7 days ago /bin/sh -c #(nop) USER [root] 0B <missing> 7 days ago /bin/sh -c #(nop) USER [company:company] 0B <missing> 7 days ago |5 commit=d64d27b07439e6cfff7422acafe440a946… 3.92MB <missing> 7 days ago /bin/sh -c #(nop) LABEL com.company.build.r… 0B <missing> 7 days ago |5 commit=d64d27b07439e6cfff7422acafe440a946… 4.85kB <missing> 7 days ago /bin/sh -c #(nop) ARG commit 0B <missing> 7 days ago /bin/sh -c #(nop) ARG date 0B <missing> 7 days ago /bin/sh -c #(nop) ARG repo 0B <missing> 7 days ago /bin/sh -c #(nop) ARG org 0B <missing> 7 days ago /bin/sh -c #(nop) ARG version 0B <missing> 5 weeks ago /bin/sh -c #(nop) CMD ["/bin/sh"] 0B <missing> 5 weeks ago /bin/sh -c #(nop) ADD file:88875982b0512a9d0… 5.53MB
The third column (CREATED BY) is abbreviating the commands which makes it hard to reconstruct the original Dockerfile. Is it possible to get the full commands in the third column?
Thanks for reading.
docker ps --no-trunc will display the full command along with the other details of the running containers.
docker logs <container id> will show you all the output of the container run. If you're running it on ECS, you'll probably need to set DOCKER_HOST=tcp://ip:port for the host that ran the container. My container is already stopped. Using the cmd line doing, docker run -d image, it returns me the container id.
First of all, to list all running containers, use the docker ps command. Then, with the docker logs command you can list the logs for a particular container. Most of the time you'll end up tailing these logs in real time, or checking the last few logs lines.
The docker image history command, or it's older synonym docker history , can help answer all these questions. Docker images are constructed in layers, each layer corresponding to a first approximation to a line in a Dockerfile . The history command shows these layers, and the commands used to create them.
You can add the flag --no-trunc
to see the full command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With