Answer the question
In order to leave comments, you need to log in
Docker-compose, Windows 10: multiple local sites?
Hello!
I'm trying to set up a local development environment (LAMP), figuring out Docker.
All sites I have are in the Sites folder with the following structure:
/Sites
-- site1.local
-- www
-- site2.local
-- www
version: "3"
services:
webserver:
build:
context: ./bin/webserver
container_name: 'sp-webserver'
restart: 'always'
ports:
- "80:80"
- "443:443"
links:
- mysql
volumes:
- ${DOCUMENT_ROOT-./www}:/var/www/html
- ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
- ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
- ${LOG_DIR-./logs/apache2}:/var/log/apache2
mysql:
build: ./bin/mysql
container_name: 'sp-mysql'
restart: 'always'
ports:
- "3306:3306"
volumes:
- ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
- ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: sp-demo
MYSQL_USER: sp-demo
MYSQL_PASSWORD: sp-demo
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: 'rb-phpmyadmin'
links:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: 3306
ports:
- '8080:80'
volumes:
- /sessions
redis:
container_name: 'rb-redis'
image: redis:latest
ports:
- "6379:6379"
docker-compose up -d
? Is it possible to do this without changing ports? Answer the question
In order to leave comments, you need to log in
Each site has its own container and another one next to it purely for a web server that sends traffic to one or another backend by name
You can allocate a separate network and register domain names in the host machine in the /etc/hosts file.
Configuration example: https://github.com/YekitKsv/docker-templates
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question