Installing Docker:
Installing Docker varies depending on your operating system, but the general process involves:
- Download Docker:
Visit the official Docker website and choose the version compatible with your OS (Windows, macOS, or Linux): https://docs.docker.com/get-started/ - Run the Installer:
Follow the setup wizard instructions to install Docker Engine. - Verify Installation:
After installation, open a terminal or command prompt and check the version: docker-version (With image code)
This confirms that Docker is successfully installed on your system.
Common Docker Commands
Once Docker is installed, here are some essential commands to get you started.
| Command | Description |
|---|---|
| docker --version | Displays installed Docker version |
| docker pull <image-name> | Downloads an image from Docker Hub |
| docker images | Lists downloaded Docker images |
| docker run <image-name> | Runs a container from an image |
| docker ps | Lists running containers |
| docker ps -a | Lists all containers (running + stopped) |
| docker exec -it <container-id> bash | Opens terminal inside a container |
| docker stop <container-id> | Stops a running container |
| docker kill <container-id> | Force-stops a container |
| docker rm <container-id> | Removes a stopped container |
| docker rmi <image-id> | Deletes an image |
Conclusion
By now, you know how to:
- Install Docker on your system
- Verify installation
- Use key Docker commands for everyday container management
With these basics, you can confidently start experimenting with containers, pulling images from Docker Hub, and building your own.