How to Easily Perform Daily Tasks with Docker Commands (Part -2)
In this article, we’ll explore some of the basic Docker commands that you can use to create and manage Docker images, and networks in your day to day tasks.
Advanced Docker Commands
docker build
The docker build command is used to build a Docker image from a Dockerfile. Here’s an example:
docker build -t my-image:latest .
This command will build a Docker image from the Dockerfile in the current directory and tag it with my-image:latest. You can replace my-image and latest with any other name and tag that you want to use.
docker exec
The docker exec command is used to execute a command inside a running container. Here’s an example:
docker exec container_name_or_id ls /
This command will execute the ls command inside the container with the specified name or ID.
docker commit
The docker commit command is used to create a new Docker image from a running container. Here’s an example:
docker commit container_name_or_id my-new-image:latest
This command will create a new Docker image from the container with the specified…