Answer the question
In order to leave comments, you need to log in
Why don't static IPs work for Docker containers?
Good afternoon, when you raise the container through docker-compose, everything seems to be set, but at the same time I can’t access the static IP address on Windows 10, which I define in the networks section of the docker-compose.yml file.
At the same time on Linux everything is put and works. I suspect that the problem lies somewhere in the Windows network settings, but I do not know where exactly. Below is my docker-compose.yml
version: '3'
services:
webapp:
build:
context: ./docker/webapp/
dockerfile: Dockerfile
volumes:
- ./sites/webapp:/var/www/html
- ./docker/webapp/vhosts:/etc/apache2/sites-enabled
depends_on:
- database
ports:
- 80:80
- 443:443
networks:
app_net:
ipv4_address: 172.19.199.2
database:
image: mysql:5.7
environment:
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: mysql
ports:
- 3306:3306
volumes:
- database_volume:/var/lib/mysql
networks:
app_net:
ipv4_address: 172.19.199.1
phpmyadmin:
image: phpmyadmin/phpmyadmin
depends_on:
- database
environment:
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: mysql
PMA_HOST: mysql
PMA_PORT: 3306
ports:
- 8080:80
volumes:
database_volume:
networks:
app_net:
ipam:
driver: default
config:
- subnet: 172.19.199.0/16
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question