Step [1] – What is the docker-compose Up command
The docker compose up command aggregates the output of each container (like docker compose logs –follow does).
Step [2] – What is the docker-compose stop command
To stop containers running in the background, use the docker-compose stop command:
Step [3] – What is the docker-compose Down command
Running this command in a terminal or within a script stops and removes all containers, networks, and volumes established by the docker-compose up command
To use it, simply navigate to your project directory and execute docker-compose down.
Step [4] – What is docker command to check services name
docker-compose config --services
Step [5] – What is Docker command to check Mysql or MariaDB Version
docker-compose exec db mysql -V
Step [6] – Which Command is being used to check total number of containers running right now
docker ps
Step [7] – Which Docker Command used for Restart Services
docker-compose restart
Step [8] – Linux command to check current path
Step [9] – List of required PHP 8.3 Extension for Linux/Docker/WSL2 (Magento 2 Installation)
sudo apt install php8.3-curl
sudo apt install php8.3-mbstring
sudo apt install php8.3-xml
sudo apt install php8.3-bcmath
sudo apt install php8.3-intl
sudo apt install php8.3-soap
sudo apt install php8.3-zip
sudo apt install php8.3-gd
sudo apt install php8.3-xsl
if pdo related issue displaying run below command & enable pdo extension
sudo apt install php8.3-mysql
Step [9] – Docker Command to find all installed images
docker images
Step [10] – Docker Command to find all installed volumes
docker volume ls
Step [11] – What is purpose of command “docker exec -it php bash”
docker exec -it php bash
It allows you to start an interactive Bash shell inside a running php
container.
Open a Bash shell inside the php container.
Gain interactive access to the container, where you can:
- Run Linux commands.
- Explore or modify the file system.
- Execute PHP commands or scripts.
- Check log files, configurations, etc.
This is useful for debugging or managing running containers in real-time without stopping or recreating them.
Step [12] – What is purpose of docker-compose up -d --build
The docker-compose up -d --build
command is used to start or rebuild Docker containers as defined in a docker-compose.yml
file, with a few key actions:
Example Scenario
Let’s assume your docker-compose.yml
file has the following services:
yamlCopy codeversion: '3'
services:
web:
build: ./web
ports:
- "8080:80"
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: example
web
: This service is built from a Dockerfile located in the./web
directory.db
: This service uses the officialmysql:5.7
image.
When you run docker-compose up -d --build
, the following happens:
- Docker Compose rebuilds the
web
service image using the Dockerfile in the./web
directory. - It starts the
web
service on port8080
, mapping it to port80
inside the container. - The
db
service using themysql:5.7
image starts with the root password set toexample
. - Both services run in the background (detached mode), allowing you to continue using the terminal.
Step [13] – If command docker-compose restart do not put in correct path
Once put command docker-compose restart do not put in correct path as below
Step [14] – Navigate wsl2 file path in windows 11
Type \\wsl$\ in File Explorer
Step [14] –