0% found this document useful (0 votes)
10 views1 page

Docker Compose

The document provides a guide on using Docker Compose, including commands for starting and stopping services, executing commands within containers, and defining configurations in a compose file. It outlines the structure of a Docker Compose file, including versioning, services, volumes, and networks. Key components include defining services like 'web' and 'database', specifying ports, and creating networks and volumes for container management.

Uploaded by

adhamayad000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Docker Compose

The document provides a guide on using Docker Compose, including commands for starting and stopping services, executing commands within containers, and defining configurations in a compose file. It outlines the structure of a Docker Compose file, including versioning, services, volumes, and networks. Key components include defining services like 'web' and 'database', specifying ports, and creating networks and volumes for container management.

Uploaded by

adhamayad000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

TOP KEYS ( version , services , volumes , networks )

docker-compose up → up services must write this command on context of compose file


-f nam/of/file → for compose files that not named by default name
docker-compose up & → & show what happened when excute

docker-compose down → delete and stop all services

docker-compose exec service-name command

***************************************************

version:3.7 → first line in Docker-Compose

****************************************************

services: # All containers inside it


web:
container_name: web-server → name for container
build: . → use docker file in the build context
command: nginx -s reload → run this command on container when start
ports:
- target: 80 → port service
published: 80 → on host
networks:
- proj-network
volumes:
- type: volume
source: volume-name
target: /path/in/container

database:
image: "adham00/sql-server:v1.0" → use docker file in the build context
command: nginx -s reload → run this command on container when start
ports:
- "8080:80"
networks:
- proj-network
volumes:
- app1-data:/usr/src/app

****************************************************

volumes:
database-data: → volume name == craete volume

****************************************************

networks:
proj-network: → network name == craete network
driver: brigde
backend-network:
internal: true → make this network internal and canot access internet

You might also like