On 2021-02-02 16:23, lejeczek via Podman wrote:
Hi guys
I'm bit puzzled but am a novice same time so go easy on me. I've created a pod
-> $ podman pod create --name nista --publish "80" --publish "3306" --publish "4444" --publish "4567" --publish "4568"
and put a wordpress into it, but cannot access it, port 80 does not respond. From the host: -> $ netstat -utapn Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 897/sshd tcp 0 0 0.0.0.0:42043 0.0.0.0:* LISTEN 3557/conmon tcp 0 0 0.0.0.0:46523 0.0.0.0:* LISTEN 3557/conmon tcp 0 0 0.0.0.0:33439 0.0.0.0:* LISTEN 3557/conmon tcp 0 0 0.0.0.0:46079 0.0.0.0:* LISTEN 3557/conmon tcp 0 0 0.0.0.0:45123 0.0.0.0:* LISTEN 3557/conmon tcp 0 0 10.3.1.223:22 10.3.1.42:46596 ESTABLISHED 1192/sshd: root [pr tcp6 0 0 :::22 :::* LISTEN 897/sshd udp 0 0 127.0.0.1:323 0.0.0.0:* 855/chronyd udp6 0 0 ::1:323 :::* 855/chronyd
-> $ podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0a205c9cc6bb k8s.gcr.io/pause:3.2 37 minutes ago Up 34 minutes ago 0.0.0.0:45123->80/tcp, 0.0.0.0:46079->3306/tcp, 0.0.0.0:33439->4444/tcp, 0.0.0.0:46523-42043->4567-4568/tcp 90422a2812c9-infra 17367d02b92a docker.io/library/wordpress apache2-foregroun... 37 minutes ago Up 34 minutes ago 0.0.0.0:45123->80/tcp, 0.0.0.0:46079->3306/tcp, 0.0.0.0:33439->4444/tcp, 0.0.0.0:46523-42043->4567-4568/tcp nista-wordpress
Then I added 'mariadb' but similarly port 3306 from/on the host is dead silent. I'm trying a replica of what I have done on another box, pre-stream Centos, where curiously bits look differently: -> $ netstat -utanp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 947/sshd tcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 5225/conmon tcp 0 0 0.0.0.0:4568 0.0.0.0:* LISTEN 5225/conmon tcp 0 0 0.0.0.0:4444 0.0.0.0:* LISTEN 5225/conmon tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 5225/conmon tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5225/conmon tcp 0 68 10.3.1.224:22 10.3.1.42:35088 ESTABLISHED 6001/sshd: root [pr tcp6 0 0 :::22 :::* LISTEN 947/sshd tcp6 0 0 :::111 :::* LISTEN 1/systemd udp 0 0 0.0.0.0:111 0.0.0.0:* 1/systemd udp 0 0 127.0.0.1:323 0.0.0.0:* 890/chronyd udp6 0 0 :::111 :::* 1/systemd udp6 0 0 ::1:323 :::* 890/chronyd
Creation of both pod & container went without errors. (I'm on centos Stream) Is there a problem with port mapping or I'm missing something trivial there?
It looks like you want to access forwarded ports at the same number on the host as is used in the container? For example, access Wordpress via port 80 on the host? If so, you probably want to use `-p 80:80` to specify that the host port and container port must match. There was a bug in Podman 2.0 and 2.1 where `-p 80` would bind port 80 on the host to port 80 in the container, but this is incorrect - if you only specify a single port number, the correct behavior (which we restored with Podman 2.2) is to forward port 80 in the container to a random port on the host. If you want to force port 80 in the container to be forwarded to port 80 on the host, you must use `-p 80:80` and specify both host and container numbers. Sorry for any confusion this may have caused! Thanks, Matt Heon
many thanks, L.
_______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io