you can use --net mynet with --network-alias myweb

make sure you have podman-plugins installed then try the following

here is an example

podman network create mynet
podman run -d --net mynet --network-alias myweb busybox httpd -f -p 80 -h /etc
podman run --rm -ti --net mynet busybox wget -O - http://myweb/hosts

see 

https://github.com/containers/podman-compose/issues/379



On Tue, Jan 4, 2022 at 4:52 PM Michael Biarnes Kiefer <mbiarnes@redhat.com> wrote:
Hi,

I am new to podman.
I have this problem:
The Docker option --link is legacy and doesn't work any-more.
Using podman right now I saw that this option should be replaced somehow by --network or --pod.

The thing is I tried several things with --network or --pod but somehow two different containers running (from two different images) can't communicate to each other:
Before (when Docker --link still was available):
$ podman images
REPOSITORY                                              TAG                     IMAGE ID                               CREATED            SIZE
localhost/kiegroup/kie-server-showcase                               7.63.0.Final  7de306f0d498  20 minutes ago  1.03 GB
localhost/kiegroup/business-central-workbench-showcase  7.63.0.Final  446a00d242c2  10 days ago       1.11 GB

podman run -p 8083:8080 -p 8003:8001 -i -t --name business-central-wb kiegroup/business-central-workbench-showcase:7.63.0.Final (runs the  446a00d242c2 container)
podman run -p 8088:8080 -i -t --name kieserver-wb --link business-central-wb:kie-wb kiegroup/kie-server-showcase:7.63.0.Final (run 7de306f0d498 container linked to 446a00d242c2)

Both Containers could communicate and share different vars.

I tried to create a network and run both containers with --network <createdNetwork> or I created a pod and run both containers with --pod <created pod> option, but somehow
the running container doesn't share the needed values. I do podman inspect and look to container values - and they are there as expected.

What do I wrong?
podman version 3.4.4
OS: Fedora 34

ThanX

Michael

--

Michael Biarnés Kiefer

Release engineer

EMEA ENG Product-Middleware

Red Hat SL Barcelona Spain

_______________________________________________
Podman mailing list -- podman@lists.podman.io
To unsubscribe send an email to podman-leave@lists.podman.io