2

I created a pod with an image to publish a nextjs site that has a lot of manual modifications

I originally created the pod and image with the image port 3000 mapped to the host port 3000 using this one-liner:

podman run -dt --pod new:alpinenpmpod -p 3000:3000 alpine

How do I map the image's port 3000 to host port 80 now after that the pod and image have been created?

output of podman pod inspect alpinenpmpod:

{
    "Id": "c1abdf9e53b7cf13f232d0f4946a4806261086432fbd5109e38eb7cf8610a98e",
    "Name": "alpinenpmpod",
    "Created": "2020-08-28T12:25:07.442784426-07:00",
    "State": "Stopped",
    "Hostname": "alpinenpmpod",
    "CreateCgroup": true,
    "CgroupParent": "/libpod_parent",
    "CgroupPath": "/libpod_parent/c1abdf9e53b7cf13f232d0f4946a4806261086432fbd5109e38eb7cf8610a98e",
    "CreateInfra": true,
    "InfraContainerID": "745662de8d1a508d68ea12ab8c764899dcf752aa10d48aafbd026e1794b50d2b",
    "InfraConfig": {
        "PortBindings": {
            "3000/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "3000"
                }
            ]
        },
        "HostNetwork": false,
        "StaticIP": "",
        "StaticMAC": null,
        "NoManageResolvConf": false,
        "DNSServer": null,
        "DNSSearch": null,
        "DNSOption": null,
        "NoManageHosts": false,
        "HostAdd": null,
        "Networks": null
    },
    "NumContainers": 2,
    "Containers": [
        {
            "Id": "419dec5dea94d7afd1d1d8d3484857bdeac04b553820c59aab14d41674472bc9",
            "Name": "vigorous_brattain",
            "State": "exited"
        },
        {
            "Id": "745662de8d1a508d68ea12ab8c764899dcf752aa10d48aafbd026e1794b50d2b",
            "Name": "c1abdf9e53b7-infra",
            "State": "configured"
        }
    ]
}

Also, is there a way I can export this pod along with its images so I can run them somewhere else?

BMitch
  • 231,797
  • 42
  • 475
  • 450
AveryFreeman
  • 1,061
  • 2
  • 14
  • 23
  • You can't change the port bindings for a container (or a pod) once it's started. The solution is to stop it and restart it with the correct bindings. – larsks Aug 29 '20 at 01:37
  • I found the only way to create new pod port mapping is to destroy the pod and create a new one. Thankfully, I exported the container from the pod, so it's easy enough just to import it again if I need to. – AveryFreeman Aug 29 '20 at 06:47

0 Answers0