tutorial for using multiple docker container and proxy nginx for manage multiple project.
version: '2'
services:
nginx-proxy:
container_name: nginx-proxy
image: jwilder/nginx-proxy
network_mode: "bridge"
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
mysql:
container_name: mysql_global
image: mysql:5.6
network_mode: "bridge"
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=default
- MYSQL_DATABASE=default
- MYSQL_PASSWORD=default
portainer:
container_name: portainer-global
image: portainer/portainer
ports:
- "8001:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
the file <docker-compose.yml> is principal file. Into file is set custom network for all containers with you wuold using with reverse proxy.
The <docker-compose.yml> start with some container:
You can edit "network_mode" with the network that reverese proxy using.
Remember every container of the your project will have to use with the network of the reverse proxy.