Docker Ports (Port Mapping) 
We must map the port on our host (like our laptop) to the port on the docker container to access it from the outside. Port mapping helps here.

docker run -d -p <port_on_host> 

 

Docker Login
The Docker login command authenticates you to the Docker hub for pushing and pulling images.

docker login 

After entering your login and password, DockerHub will authenticate you and let you complete jobs. 

 

Docker Push
The following command pushes your Dockerfile-built image to DockerHub, the remote registry. To learn How to Push a Container Image to Docker Repository?

docker push <Image name/Image ID> 


Docker Build
The docker build command builds Dockerfile-based images. Replace image_name with the image you built with and tag number. Current directory is “dot”.

docker build -t image_name:ta

 

Docker Stop
You can stop and start Docker containers for container maintenance. Use these commands to stop and start containers.

docker stop container_name_or_id


Stop Multiple Containers
Avoid stopping one container. Use these commands to stop multiple containers.

docker stop container1 container2 container3

 

Docker Restart
Docker containers may fail to start due to problems. Use these commands to restart containers to resolve them.

docker restart container_name_or_id

 

Docker Inspection
Docker containers will run across real-time issues to debug. Use these commands

docker inspect container_name_or_id

 

Docker Commit command
After launching containers with the current image, you can update them by interacting with them. Use the following commands to build an image.

docker commit container_name_or_id new_image_name:tag

Lists the status of all docker containers

docker ps -a


Related Question