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

can't ping use service name #541

Closed
h25302 opened this issue Aug 20, 2022 · 2 comments
Closed

can't ping use service name #541

h25302 opened this issue Aug 20, 2022 · 2 comments

Comments

@h25302
Copy link

h25302 commented Aug 20, 2022

docker-compose.yml:

version: '3.9'

services:
  db:
    image: mariadb
    container_name: db
    ports:
      - '3306:3306'
    restart: always

  busybox:
    image: busybox
    container_name: busybox
    tty: 'true'
    restart: unless-stopped

podman-compose up -d:

podman-compose version: 1.0.4
['podman', '--version', '']
using podman version: 4.1.1
** excluding:  set()
['podman', 'ps', '--filter', 'label=io.podman.compose.project=yhit', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
podman pod create --name=pod_yhit --infra=false --share=
81b98fd4f3f4cdb731f2e59824da97f95932f207bb31a32d60c5b5ff52ff2fff
exit code: 0
['podman', 'network', 'exists', 'yhit_default']
podman run --name=db -d --pod=pod_yhit --label io.podman.compose.config-hash=f28cb40f52bbd6253bb2e0878382697287ff9ef94b83561cb7eac3c6142c34f7 --label io.podman.compose.project=yhit --label io.podman.compose.version=1.0.4 --label [email protected] --label com.docker.compose.project=yhit --label com.docker.compose.project.working_dir=/chy/podman/yhit --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=db --net yhit_default --network-alias db -p 3306:3306 --restart always mariadb
92a09bf4160de180b88a771424dfdc91e6a97f91fbb34c17d5ae3b87ade3476a
exit code: 0
['podman', 'network', 'exists', 'yhit_default']
podman run --name=busybox -d --pod=pod_yhit --label io.podman.compose.config-hash=f28cb40f52bbd6253bb2e0878382697287ff9ef94b83561cb7eac3c6142c34f7 --label io.podman.compose.project=yhit --label io.podman.compose.version=1.0.4 --label [email protected] --label com.docker.compose.project=yhit --label com.docker.compose.project.working_dir=/chy/podman/yhit --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=busybox --net yhit_default --network-alias busybox --tty --restart unless-stopped busybox
1196833e780a0a8694ca313742103da4c778a06a96470b6571f48c3f3d3ca6b6
exit code: 0

but run
podman exec -it busybox ping db:

ping: bad address 'db'

Sorry, my English is poor. I hope you can understand what I mean

@leonidas-o
Copy link

@Yhit Don't know about your settings or the default settings, but how I run It, definitely works. I also switched from cni to the new netavark network backend.
So you can try the following (will post all commands, I guess you have the first part done already, but it maybe could help others):

sudo su -
dnf install podman python3-pip netavark aardvark-dns

As non-root user:

pip3 install --user podman-compose

After installation, if you would like to migrate all your containers to use Netavark, you must set network_backend = "netavark" under the [network] section in your containers.conf, typically located under /usr/share/containers/containers.conf.

podman info --format {{.Host.NetworkBackend}} # shows you the current setting
sudo vi /usr/share/containers/containers.conf # set network_backend = "netavark"
podman info --format {{.Host.NetworkBackend}}

Maybe you have to log out of the current session and log in again, not sure here anymore.

podman network create newnetwork
podman network inspect podman # default podman network "dns_enabled": false
podman network inspect newnetwork # newly created network "dns_enabled": true

Containers can be joined to a network when they are created with the --network flag, or after they are created via the podman network connect and podman network disconnect commands.

@h25302
Copy link
Author

h25302 commented Aug 21, 2022

@leonidas-o
Thank you, thank you, thanks again.
I'm so happy.
It's finally working properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants