Всем привет, не могу понять, почему контейнеры не видят друг друга по имени.
Oracle Linux 8
Docker Compose version v2.2.3
Podman version 3.3.1
Запуск происходит через Docker Compose.
version: "3.7"
services:
php:
container_name: unit
image: unit:1.26.1
ports:
- "8080:8080"
volumes:
- ./www/:/var/www/
restart: unless-stopped
hostname: hostname-unit
web:
container_name: nginx
image: nginx:1.21.5
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/:/etc/nginx/
links:
- php:unit
restart: unless-stopped
hostname: hostname-nginx
Создавал и свои сети и на дефолтных от DC не хотят пинговаться по имени.
#podman inspect nginx -f "{{json .NetworkSettings.Networks }}"
{
"stack_default": {
"EndpointID": "",
"Gateway": "10.89.2.1",
"IPAddress": "10.89.2.4",
"IPPrefixLen": 24,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "c6:be:a4:e2:d3:6a",
"NetworkID": "stack_default",
"DriverOpts": null,
"IPAMConfig": null,
"Links": null,
"Aliases": ["nginx", "web"]
}
}
#podman inspect unit -f "{{json .NetworkSettings.Networks }}"
{
"stack_default": {
"EndpointID": "",
"Gateway": "10.89.2.1",
"IPAddress": "10.89.2.5",
"IPPrefixLen": 24,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "62:fd:bc:17:87:7b",
"NetworkID": "stack_default",
"DriverOpts": null,
"IPAMConfig": null,
"Links": null,
"Aliases": ["php", "unit"]
}
}
#podman exec -ti nginx
/ # ping php
ping: bad address 'php'
/ # ping unit
ping: bad address 'unit'
/ # ping 10.89.2.5
PING 10.89.2.5 (10.89.2.5): 56 data bytes
64 bytes from 10.89.2.5: seq=0 ttl=64 time=0.070 ms
64 bytes from 10.89.2.5: seq=1 ttl=64 time=0.083 ms
64 bytes from 10.89.2.5: seq=2 ttl=64 time=0.069 ms
64 bytes from 10.89.2.5: seq=3 ttl=64 time=0.080 ms
/ # cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
10.89.2.4 hostname-nginx nginx
10.89.2.1 host.containers.internal
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
10.89.2.5 hostname-unit unit
10.89.2.1 host.containers.internal
# podman network inspect stack_default
[
{
"args": {
"podman_labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "stack",
"com.docker.compose.version": "2.2.3"
}
},
"cniVersion": "0.4.0",
"name": "stack_default",
"plugins": [
{
"bridge": "cni-podman3",
"hairpinMode": true,
"ipMasq": true,
"ipam": {
"ranges": [
[
{
"gateway": "10.89.2.1",
"subnet": "10.89.2.0/24"
}
]
],
"routes": [
{
"dst": "0.0.0.0/0"
}
],
"type": "host-local"
},
"isGateway": true,
"type": "bridge"
},
{
"capabilities": {
"portMappings": true
},
"type": "portmap"
},
{
"backend": "",
"type": "firewall"
},
{
"type": "tuning"
}
]
}
]
Так же ставил LINKS между контейнерами, но воз и ныне там ....
При запуске без DC, картина не меняется. При проверке сеть одна.
#podman inspect container_name -f "{{json .NetworkSettings.Networks }}"
Почему - то при выводе результата отсутствуют данные по контейнерам внутри сети.
#podman network inspect network_name