Resources

CLI


Basis

docker-compose up -f /pathToComposeFiles
Create a network and run containers in it.

docker-compose stop -f /pathToComposeFiles
Stop containers.

docker-compose down -f /pathToComposeFiles
Remove network and containers.

Compose File Examples


Network

version: "3"


services:
	myContainer1:
		image: nginx
		ports: 
			- "8081:80"
		restart: always		   # Restart at machine startup.
		
	myContainer2:
		image: nginx
		ports: 
			- "8082:80"
		restart: always		   # Restart at machine startup.
		networks:			   # Put the container in the network
			ipv4_address: 192.168.168.0.100

   
networks:
	myNetwork:
		ipam:				    # IP Address Managment
			driver: default 	# Bridge
			config:
				- subnet: “192.168.168.0.0/24”