HappyKoala
HappyKoala

Reputation: 267

How to implement access to containers from the outside in Podman

My case is this: I want to deploy a website that uses a separated

front-end (web writen by Nextjs, it will using localhost:3000 port) project,

and a back-end (backend writen by django, it will using localhost:8000 port) project.

Since the backend project uses postgres,redis, images are currently included:

REPOSITORY                  TAG         IMAGE ID      CREATED       SIZE
docker.io/library/nginx     latest      0469e929ca63  10 days ago   197 MB
docker.io/library/python    3.12-slim   e52abe66893e  3 weeks ago   159 MB
docker.io/library/redis     latest      e48e4ac2fa6b  5 weeks ago   142 MB
docker.io/library/postgres  latest      f91377b220f1  7 weeks ago   461 MB
localhost/web
localhost/backend 

Given the management situation in production, I decided to put them in a pod.

But here's where the problem arises.

% podman pod create --name test -p 80:8000 -p 80:3000 -p 80:80
e5e894ac7d4b77591f4c97fb1ff0f45debc20e9699e741fd1006a4f3d93efb52
%  podman run --name nginx --pod test -v ~/developer/podmanVM/nginx:/etc/nginx/conf.d:z -d docker.io/library/nginx
Error: starting some containers: internal libpod error

There is no record of nginx failure in the log. If, for example, I use a command without port -p, it creates normally the

% podman pod create --name test1
c8b0ddd5deb78cdf13fe757406e34ce9fe9b58e26ae843bfd64c152f1d68c43f
% podman run --name nginx1 --pod test1 -v ~/developer/podmanVM/nginx:/etc/nginx/conf.d:z -d docker.io/library/nginx
062919f2ffc349e5807b3d838d82d772451ab52f84185cee55689805f245f235

Because I want I can access localhost from browser to test this project, so I expose port 3000,8000 at pod level, but why I get error?

Upvotes: 0

Views: 156

Answers (0)

Related Questions