3 ms·
How about "your docker builds are wrong", too. Don't generate some random id and a tag (as in the post). Use docker's "-iidfile" flag when building to write th
by cpuguy83 4y ago
How about "your docker builds are wrong", too.
Don't generate some random id and a tag (as in the post).
Use docker's "-iidfile" flag when building to write the actual id of the image to a file which can then be used in a "docker run".
Likewise, you can use "--cidfile" in a "docker run" to output the id to a file and use that later for accessing it.
- bin_bash 4y agoCan you explain this a bit further? I don't think I understand the point, but I've been using docker more lately and this sounds like it could possibly be something I could use. It sounds like I could do something like: 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
- cpuguy83 4y agoNot quite. --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 ---