To deploy and run an application in a Docker container, you have two options –
- You can use docker start command (or)
- Use the docker run command
Which one do you use and under which scenarios you use run and start commands?
docker start command
START command is used to start an already created container.
You pass the container identifiers as arguments to the command and docker starts those containers.
a START command generally follows a BUILD command where a new container image is built.
docker start [OPTIONS] CONTAINER [CONTAINER...]
docker run command
On the other hand, a RUN command is used to CREATE and START a non-existing container from a specified image.
docker run [options] <image_name> [initial_command]