by bin_bash · 4y ago · 0 comments
docker build --iidfile .dockerid && \
docker run -it /bin/bash --cidfile .dockerid
Without needing to copy and paste the image ID? Is that right? Why wouldn't I just tag the image? docker build -t myimage && \
docker run -it myimage /bin/bash--iidfile writes the image id of the build to a file.
--cidfile writes the container id of the container to a file.
To use the output of --iidfile in a "docker run", instead of specifying an image name call "$(cat <iidfile>)". As an example:
docker build --iidfile out/imageid ...
docker run ... $(cat out/imageid)
--- edit for formatting ---