What's Docker, Anyway? ๐ค
Docker is a tool use for package management/containerization. docker is a set of platform as a service product that use os-level virtualization to deliver software in packages called container. it is use for build, test and deploy application quickly.
Why Docker? ๐
Think of Docker as a superhero cape for your apps. It makes your software fearless, ready to conquer any server or computer without a fuss. Plus, it's like having your own mini-universe where every app lives happily, isolated from the chaos of the outside world.
How Does Docker Work? ๐ต๏ธโโ๏ธ
Picture this: you have a treasure chest (that's your Docker container) filled with jewels (your app and its buddies). Docker uses some magical spells (technically called containerization) to keep each treasure safe and sound. It even has a manifest (Dockerfile) that tells it exactly how to create the treasure chest.
Some Docker Basics Commands:
Absolutely! Docker has a set of fundamental commands that can help you navigate the containerized seas with ease. Here's a quick guide to some essential Docker commands:
docker run
:This command is your ship's anchor. It creates and starts a container from a given image.
docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
Example:
docker run -d -p 8080:80 nginx
-d
: Run in detached mode (in the background).-p
: Map port 8080 on the host to port 80 on the container.nginx
: The Docker image to use (Docker Image Name).
docker ps
:This command shows you the containers that are currently running.
docker ps [OPTIONS]
Example:
docker ps
- This displays a list of running containers with details like Container ID, Names, and Ports.
docker images
:Want to know what images are stored in your dockyard? This command will show you.
docker images [OPTIONS] [REPOSITORY[:TAG]]
Example:
docker images
- Lists all the available images on your system.
docker stop
:Drop the anchor! This stops a running container.
docker stop [OPTIONS] CONTAINER [CONTAINER...]
Example:
docker stop my_container
- Stops the container with the name "my_container."
docker rm
:Time to clean up. This removes one or more containers.
docker rm [OPTIONS] CONTAINER [CONTAINER...]
Example:
docker rm my_container
- Removes the container with the name "my_container."
docker rmi
:Ahoy, matey! Clear the decks by removing one or more images.
docker rmi [OPTIONS] IMAGE [IMAGE...]
Example:
docker rmi my_image
- Removes the Docker image with the name "my_image."
docker exec
:Sometimes you need to go inside the container. This command helps you execute a command inside a running container.
docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Example:
docker exec -it my_container /bin/bash
- Opens an interactive shell inside the running container named "my_container."
These are just a few basic Docker commands to get you started on your containerization adventure. As you sail further, you'll discover more commands and options to customize your Docker experience. ๐ณโ๏ธ
I'm sorry for posting a blog after so many days. Due to some personal reason I had to take a break but I am back again to share my knowledge with you I hope this useful for those who are learning DevOps. Happy Learning!