Создание Docker:
Код: Выделить всё
version: "3.8"
name: dev-environment
services:
api-resources:
container_name: api-resources
restart: always
build:
context: ./resources-api
ports:
- "3001:3001"
networks:
dev_network:
ipv4_address: 172.18.0.2
api-auth:
container_name: api-auth
restart: always
build:
context: ./auth-api
ports:
- "3002:3002"
networks:
dev_network:
ipv4_address: 172.18.0.3
db:
container_name: dev-database
image: mysql
command: --default-authentication-plugin=caching_sha2_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: MySuperPassword!
ports:
- "3306:3306"
volumes:
- database-data:/var/lib/mysql
networks:
dev_network:
ipv4_address: 172.18.0.4
phpmyadmin:
container_name: mspr-phpmyadmin
image: phpmyadmin
restart: always
ports:
- "8080:80"
environment:
- PMA_ARBITRARY=1
networks:
dev_network:
ipv4_address: 172.18.0.5
volumes:
database-data:
networks:
dev_network:
driver: bridge
ipam:
config:
- subnet: 172.18.0.0/16
gateway: 172.18.0.1
Конфигурация Iptables:
Код: Выделить всё
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:3002
64 7908 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:3001
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
36678 429M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
20 1040 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:650
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
27 1520 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
15 700 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
10032 10M DOCKER-USER all -- * * 0.0.0.0/0 0.0.0.0/0
10032 10M DOCKER-ISOLATION-STAGE-1 all -- * * 0.0.0.0/0 0.0.0.0/0
8823 10M ACCEPT all -- * br-89fd642b3dfe 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
56 3168 DOCKER all -- * br-89fd642b3dfe 0.0.0.0/0 0.0.0.0/0
1126 310K ACCEPT all -- br-89fd642b3dfe !br-89fd642b3dfe 0.0.0.0/0 0.0.0.0/0
38 2280 ACCEPT all -- br-89fd642b3dfe br-89fd642b3dfe 0.0.0.0/0 0.0.0.0/0
17269 110M ACCEPT all -- * docker0 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
0 0 DOCKER all -- * docker0 0.0.0.0/0 0.0.0.0/0
17411 1815K ACCEPT all -- docker0 !docker0 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- docker0 docker0 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- * br-282950180fab 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
0 0 DOCKER all -- * br-282950180fab 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- br-282950180fab !br-282950180fab 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- br-282950180fab br-282950180fab 0.0.0.0/0 0.0.0.0/0
96 4992 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT 16421 packets, 7896K bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (3 references)
pkts bytes target prot opt in out source destination
2 88 ACCEPT tcp -- !br-89fd642b3dfe br-89fd642b3dfe 0.0.0.0/0 172.18.0.4 tcp dpt:3306
0 0 ACCEPT tcp -- !br-89fd642b3dfe br-89fd642b3dfe 0.0.0.0/0 172.18.0.3 tcp dpt:3002
16 800 ACCEPT tcp -- !br-89fd642b3dfe br-89fd642b3dfe 0.0.0.0/0 172.18.0.5 tcp dpt:80
0 0 ACCEPT tcp -- !br-89fd642b3dfe br-89fd642b3dfe 0.0.0.0/0 172.18.0.2 tcp dpt:3001
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
pkts bytes target prot opt in out source destination
1126 310K DOCKER-ISOLATION-STAGE-2 all -- br-89fd642b3dfe !br-89fd642b3dfe 0.0.0.0/0 0.0.0.0/0
17411 1815K DOCKER-ISOLATION-STAGE-2 all -- docker0 !docker0 0.0.0.0/0 0.0.0.0/0
45222 122M RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
45280 122M RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-ISOLATION-STAGE-2 (2 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * br-89fd642b3dfe 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * docker0 0.0.0.0/0 0.0.0.0/0
18609 2174K RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/782 ... -cloud-vps
Мобильная версия