Difference between docker run and docker start

What is Docker start?

The docker start command starts any stopped container. If you use the docker create command to create a container, you can start it with this command.

What is Docker run?

The docker run command is a combination of create and start as it creates a new container and starts it immediately.

run -> runs an image

Run: create a new container of an image, and execute the container. You can create N clones of the same image. The command is: docker run IMAGE_ID and not docker run CONTAINER_ID

docker run --help

start -> starts a container.

Start: Launch a container previously stopped. For example, if you had stopped a database with the command docker stop CONTAINER_ID, you can relaunch the same container with the command docker start CONTAINER_ID, and the data and settings will be the same.

docker start --help

Docker – Container Commands (Important)

Kill running containers
docker kill $(docker ps -q)
Delete all containers (force!! running or stopped containers)
docker rm -f $(docker ps -qa)
Delete stopped containers
docker rm -v $(docker ps -a -q -f status=exited)
Delete containers after stopping
docker stop $(docker ps -aq) && docker rm -v $(docker ps -aq)

docker-machine ip default

Above command is to get the IP address of the docker-machine. You can access the Docker machine from the Host machine, using the IP address shown by the above command.

docker port a6e93aefde4d

Above command is to get the port on which the container is running