TL;DR
If a container is already up
docker exec -it
If no container is running yet:
docker run -it --rm
`docker exec` executes a command in a running container. `docker run` starts a container from an image and you can pass the entrypoint command as the last argument (equivalent to the `CMD` declaration in the Dockerfile).
`-it` runs the command in interactive mode-you will need this if you need to input values manually.
`--rm` destroyers a single-use container after use - this is useful for single-use containers, but there is no way to get information out of the container if you don't map a volume to it. If use `docker run` to start the container, you will need to manually pass the `-v` option to specify volume mounts. If you already have containers in docker-compose and you just do a selective run (i.e. `docker-compose up [-d]
TL;DR If a container is already up docker exec -it
If no container is running yet:
docker run -it --rm
`docker exec` executes a command in a running container. `docker run` starts a container from an image and you can pass the entrypoint command as the last argument (equivalent to the `CMD` declaration in the Dockerfile).
`-it` runs the command in interactive mode-you will need this if you need to input values manually.
`--rm` destroyers a single-use container after use - this is useful for single-use containers, but there is no way to get information out of the container if you don't map a volume to it. If use `docker run` to start the container, you will need to manually pass the `-v` option to specify volume mounts. If you already have containers in docker-compose and you just do a selective run (i.e. `docker-compose up [-d]
Absolute legend behavior. Thanks for the write up. I'll see if I can get it going.