I would like to run my podman image of my spring boot application directly on root. Without having to call it over a declared port.
I want to call the application over https://someaddress.com instead over http://someaddress.com:10003
Currently i start the image like that
podman run -d -it --rm --network=host --name=application-api [IMAGE]
CodePudding user response:
You must be a port mapping betwen host and container networks.
--publish, -p=[[ip:][hostPort]:]containerPort[/protocol]
podman run -p 80:80 nginx
When you assign a network with non root user or not sudo you cant assign a port 80 or 443 port a Podman container. Podman will show you this error
Error: rootlessport cannot expose privileged port 80, you can add 'net.ipv4.ip_unprivileged_port_start=80' to /etc/sysctl.conf (currently 1024), or choose a larger port number (>= 1024): listen tcp 0.0.0.0:80: bind: permission denied
For resolve it you must run a container with sudo user, mark port 80/443 as a unprivileged_port.
sudo podman run -p 80:80 nginx