Docker

Best Docker Containers COmmands You need to know

Docker is a powerful tool for containerization, which allows you to package applications and their dependencies into a consistent environment. Here are some essential Docker commands every developer and system administrator should be familiar with:

docker run

Create and start a new container from an image.  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

docker pull

Download an image from a registry (like Docker Hub). docker pull IMAGE_NAME[:TAG]

docker build

Build an image from a Dockerfile. docker build [OPTIONS] PATH | URL | -

docker ps

List running containers. docker ps [OPTIONS]

docker images

List available images on your system. docker images [OPTIONS] [REPOSITORY[:TAG]]

docker stop

Stop one or more running containers. docker stop CONTAINER [CONTAINER...]

docker start

Start one or more stopped containers. docker start CONTAINER [CONTAINER...]

docker restart

Restart a running or stopped container. docker restart CONTAINER [CONTAINER...]

docker rm

Remove one or more containers. docker rm CONTAINER [CONTAINER...]

docker rmi

Remove one or more images. docker rmi IMAGE [IMAGE...]

docker exec

Run a command in a running container. docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

docker logs

Fetch the logs of a container. docker logs [OPTIONS] CONTAINER

docker cp

Copy files/folders between a container and the local filesystem. docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|- docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH

docker network

Manage Docker networks. docker network [COMMAND]

docker-compose

A tool for defining and running multi-container Docker applications. (Requires a docker-compose.yml file) docker-compose [OPTIONS] [COMMAND]

These commands are just the basics. Docker has a rich set of features and options that you can explore as you become more comfortable with containerization.

Thank You