This document provides the necessary steps to deploy the application using Docker Compose.
- Ensure Docker and Docker Compose are installed on your system.
First, you need to export your host IP address as an environment variable. This will be used in the Docker Compose file.
Open your terminal and run the following command:
export HOST_IP=$(hostname -I | awk '{print $1}')
This command fetches the IP address of your host machine and stores it in the HOST_IP
environment variable.
After exporting the HOST_IP
variable, you can start the application using Docker Compose. Run the following command:
docker compose up -d
The -d
flag tells Docker Compose to run the containers in detached mode, meaning they will run in the background.
To verify that the containers are running, use the following command:
docker ps
This will list all running containers. You should see the containers defined in your docker-compose.yml
file listed here.
Once the containers are running, you can access the application through your web browser or any other client as per the service configuration in your docker-compose.yml
.
To stop and remove the running containers, use the following command:
docker compose down
This will stop the containers and remove them along with any networks created by Docker Compose.