I often do the following:
docker run -dt myimage
docker ps # This step gives the container id necessary for next step
docker exec -it <container-id> bash
Ideally I'd like to do it all in one line
docker run -dt myimage && docker exec -it <id> bash
but I don't know how to get the container id to docker exec
without looking it up in a separate step.
Question
Is there a one-liner to run an image and shell into its container?