What is Docker?
Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host. Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host. You can easily share containers while you work, and be sure that everyone you share with gets the same container that works in the same way.
Docker Commands
Docker ps
This command is used to list the running containers.
Docker ps -a
This command is used to show all containers in different states (running, stopped, exited, etc).
Docker Pull
To pull an image from the registry to the local machine.
Docker Create
The docker container create (or shorthand: docker create ) command creates a new container from the specified image, without starting it.
Here we will use the --name to give the name to our container.
Here we will use the Sleep 5000 to make sure that our container doesn't exit immediately and at least stay live for 5000 seconds.
Docker Start
The command is used to start one or more stopped Docker containers.
Docker Stop
Stop one or more running containers.
Docker run
The docker run command runs a command in a new container, pulling the image if needed and starting the container.
Docker logs
The docker logs command batch-retrieves logs present at the time of execution.
Docker stats
The docker stats command returns a live data stream for running containers.
Docker rm
The command is used to delete the container.