Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rootless Podman-compose containers cannot reach eachother #314

Open
realSConway opened this issue May 31, 2023 · 1 comment
Open

rootless Podman-compose containers cannot reach eachother #314

realSConway opened this issue May 31, 2023 · 1 comment
Labels
question Further information is requested

Comments

@realSConway
Copy link

Hello experts,

I'm having issues getting two containers reach each other with rootless podman-compose. Tested using a simple test compose file.

Reference links and my findings.
https://github.com/containers/podman/blob/main/docs/tutorials/basic_networking.md, (also tried using $host IP, in compose file)
https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md
https://github.com/rootless-containers/slirp4netns#usage, (at step Make sure the tap0 is configured and connected to the Internet, i have no tap0 interface )

slirp4netns --version

slirp4netns version 1.2.0
commit: unknown
libslirp: 4.7.0
SLIRP_CONFIG_VERSION_MAX: 5
libseccomp: 2.5.4

podman-compose file:

version: '4'

services:
  container1:
    image: alpine
    command: ping container2 -c 5
    networks:
      - net
  container2:
    image: alpine
    command: sleep 3600
    networks:
      - net
networks:
  net:
    driver: bridge

Output podman-compose up:

podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.5.0
** excluding:  set()
['podman', 'ps', '--filter', 'label=io.podman.compose.project=webtest', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
['podman', 'network', 'exists', 'webtest_net']
podman create --name=webtest_container1_1 --label io.podman.compose.config-hash=8e9cbc83f8355e33f49e9023c1f48598117d7be3567eddafbaceebe075519db3 --label io.podman.compose.project=webtest --label io.podman.compose.version=1.0.6 --label [email protected] --label com.docker.compose.project=webtest --label com.docker.compose.project.working_dir=/home/support/documents/webtest --label com.docker.compose.project.config_files=podman-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=container1 --net webtest_net --network-alias container1 alpine ping container2 -c 5
455c1467872a65094d4413e37f910812b42e2a1f43bdee7df09bcf78645a1a53
exit code: 0
['podman', 'network', 'exists', 'webtest_net']
podman create --name=webtest_container2_1 --label io.podman.compose.config-hash=8e9cbc83f8355e33f49e9023c1f48598117d7be3567eddafbaceebe075519db3 --label io.podman.compose.project=webtest --label io.podman.compose.version=1.0.6 --label [email protected] --label com.docker.compose.project=webtest --label com.docker.compose.project.working_dir=/home/support/documents/webtest --label com.docker.compose.project.config_files=podman-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=container2 --net webtest_net --network-alias container2 alpine sleep 3600
0fea1c2b0d0f30a2539d4e7731883df6b9b772a95ba9743826ba556d980af8a5
exit code: 0
podman start -a webtest_container1_1
ping: bad address 'container2'
exit code: 1
podman start -a webtest_container2_1
podman network inspect webtest_net
[
     {
          "name": "webtest_net",
          "id": "bd9deb5046ae45ddf508c4a4ec369a2774a6d93f075224dd166407e9952d45f3",
          "driver": "bridge",
          "network_interface": "cni-podman2",
          "created": "2023-05-31T09:46:49.909249451+02:00",
          "subnets": [
               {
                    "subnet": "10.89.1.0/24",
                    "gateway": "10.89.1.1"
               }
          ],
          "ipv6_enabled": false,
          "internal": false,
          "dns_enabled": false,
          "labels": {
               "com.docker.compose.project": "webtest",
               "io.podman.compose.project": "webtest"
          },
          "ipam_options": {
               "driver": "host-local"
          }
     }
]

What did I miss how can I get container1 to ping container2?
Thank you for your time.

@realSConway
Copy link
Author

Small update, I managed to get tap0.

slirp4netns --configure --mtu=65520 --disable-host-loopback $(cat /tmp/pid) tap0

sent tapfd=5 for tap0
received tapfd=5
Starting slirp
* MTU:             65520
* Network:         10.0.2.0
* Netmask:         255.255.255.0
* Gateway:         10.0.2.2
* DNS:             10.0.2.3
* DHCP begin:      10.0.2.15
* DHCP end:        10.0.2.30
* Recommended IP:  10.0.2.100

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: tap0: <BROADCAST,UP,LOWER_UP> mtu 65520 qdisc pfifo_fast state UNKNOWN group default
qlen 1000
    link/ether 02:47:f7:48:9f:02 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
       valid_lft forever preferred_lft forever
    inet6 fe80::47:f7ff:fe48:9f02/64 scope link
       valid_lft forever preferred_lft forever

Where should I be running podman-compose up from? If I open a new Terminal, I still get same error and from Terminal 1 I get:

Error: creating runtime temporary files directory: mkdir /run/libpod: permission denied

@AkihiroSuda AkihiroSuda added the question Further information is requested label Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants