Getting Started with Docker Commands
Author: Vivek Chandran
Date: September 9, 2024
Once Docker is set up on your system, you can interact with it through simple commands. Here are a few core Docker commands to get you started:
Pull an Image
docker pull [image]
This fetches an image from Docker Hub
Build an Image
docker build -t [image_name] .
This command builds a Docker image from a Dockerfile.
Run a Container
docker run -d -p [host_port]:[container_port] [image]
This command runs a container and maps a local port to a port in the container.
List Running Containers
docker ps
This lists all running containers.
Stop Containers
docker stop [container_id]
This stops a running containers.
Remove a container
docker rm [container_id]
This command will remove a stopped container.