You don't have to port-forward the cli. Client source port is allocated
dynamically and usually differs from service port. So just start your
cli without port-forwarding.

Now you can't access localhost from the container so you need a few things:
1. figure out what is the IP address your host machine has in the podman
network
2. When port-forwarding the service with `oc`, add the option
`--address=192.168.133.1` (assuming 192.168.133.1 is your host IP).
3. Allow access to that ip/port in your host firewall.
4. access service from container on 192.168.133.1:6379

If redis supports connecting to a UNIX socket I guess there can be some
nicer way to forward the traffic via such and avoid dealing with IPs and
firewalls but I'll leave that now.

HTH

Just Marvin wrote on 4.08.20 г. 21:08 ч.:
> Hi,
> 
>     I'm port forwarding to a redis server running within my openshift
> cluster:
> 
> [zaphod@oc3027208274 ~]$ oc port-forward redis-1-s28xs 6379
> Forwarding from 127.0.0.1:6379 <http://127.0.0.1:6379> -> 6379
> Forwarding from [::1]:6379 -> 6379
> 
>     I also have a redis-cli built in a container which I'm running on my
> machine (where I'm doing the port-forwarding). However, starting up this
> container is proving to be impossible:
> 
> [zaphod@oc3027208274 redis-cli]$ sudo podman run --name redis-cli -p
> 6379:6379 localhost/redis-cli
> Error: cannot listen on the TCP port: listen tcp4 :6379: bind: address
> already in use
> [zaphod@oc3027208274 redis-cli]
> 
>     Whats the right way to get the redis-cli in my container communicate
> with the redis server running remotely on openshift?
> 
> Regards,
> Marvin
> 
> _______________________________________________
> users mailing list
> users@lists.openshift.redhat.com
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
> 

_______________________________________________
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to