Docker is a platform that allows you to develop, deploy, and run applications inside containers. Containers are lightweight, standalone, and portable environments that encapsulate all the dependencies and libraries required for an application to run. Docker provides tools and a platform to manage these containers efficiently.
Images
Images: An image is a lightweight, standalone, and executable package that includes everything needed to run a piece of software, including the code, a runtime, libraries, environment variables, and configuration files.
Images are often based on other images, allowing you to inherit commonly used functionalities without starting from scratch. Images are typically created using a Dockerfile, which defines the steps needed to build the image.
Containers
A container is a runtime instance of an image. It represents a runnable instance of a Docker image.
Containers run isolated from each other and from the host machine, providing a lightweight and portable way to package and run applications. Containers can be started, stopped, moved, and deleted using the Docker API or CLI
Dockerfile
A text file where you define all the steps to build your image.
Some Commands :
docker container ls (list all the container which are currentlly running)docker container ls -a (list all the containers)docker start container-name (to start the container)docker stop container-name (to stop the container)docker exec container-name command-to-execture-on-the-container (for ex : ) docker exec myUbuntu ls ( this command basically run the command inside the mentioned container)To execute an interactive Bash shell inside a running container named
container-name, use the following Docker command:docker exec -it container-name bashdocker images || docker images ls ( to see the docker images in your local machine)docker -it -p host_port:container_port container_name-it for interactive mode, -p for port mapping from container_port to the host_portPort Maping
ย

