What is Docker?

Docker is a platform where developers can package, deploy and run the application in isolated environments. If you want to learn more about Docker Introduction, Architecture. Please go through- Docker Introduction, Architecture

What is Docker Image?

Docker Image is a package that is lightweight, standalone, and executable. It includes everything required to run an application, like code, runtime and libraries, and dependencies.

Where can we use Docker?

Docker can build and deploy applications in various environments, including development, staging, UAT, and production across different OS and platforms.

Dockers commands

Now we will see some of the docker commands with their usage,

1. Run a container from an image

Command

Dockerfile
docker run

Example. docker run nginx

2. Build an image from the docker file

Command

Dockerfile
docker build

Example. docker build -t myapp:latest

3. Pull an image from the registry

Command

Dockerfile
docker pull

Example. docker pull ubuntu:latest

4. Push an image to the registry

Command

Dockerfile
docker push

Example. docker push myuser/myapp:latest

5. List all the available images on your machine

Command

Dockerfile
docker images

Example. docker images

6. List all running containers

Command

Dockerfile
docker ps

Example. docker ps

7. Stop a running container

Command

Dockerfile
docker stop

Example. docker stop mycontainer

8. Start a stopped container

Command

Dockerfile
docker start

Example. docker start mycontainer

9. Restart a running container

Command

Dockerfile
docker restart

Example. docker restart mycontainer

10. forcefully stop a running container

Command

Dockerfile
docker kill

Example. docker kill mycontainer

Thank you all for reading my article about containers.