Common commands to know
Course: Actionable Docker - chapter 5
- docker run
- docker ps
- docker kill
Running an image
Section titled “Running an image”1. Running a simple image
Section titled “1. Running a simple image”Let’s say you wan’t to run MongoDB locally https://hub.docker.com/_/mongo
docker run mongo
You will notice you can’t open it in MongoDB Compass .

Adding a port mapping
Section titled “Adding a port mapping”The reason is that you haven’t added a port mapping
docker run -p 27017:27017 mongo
Starting in detached mode
Section titled “Starting in detached mode”Adding -d will ensure it starts in the background
docker run -d -p 27017:27017 mongoInspecting a container
Section titled “Inspecting a container”docker psThis will show you all the containers you are running.
Stopping a container
Section titled “Stopping a container”docker kill <container_id>Will stop the container that you are running
In the end, this is the flow of commands -
