You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: allow containers to start using a large number of ports
Suppose we have a compose.yaml that allocates a large numbers of ports as
follows.
```
> cat compose.yaml
services:
svc0:
image: alpine
command: "sleep infinity"
ports:
- '32000-32060:32000-32060'
```
When we run `nerdctl compose up -d` using this compose.yaml, we will get
the following error.
```
FATA[0000] create container failed validation: containers.Labels: label key and value length (4711 bytes) greater than maximum size (4096 bytes), key: nerdctl/ports: invalid argument
FATA[0000] error while creating container haytok-svc0-1: error while creating container haytok-svc0-1: exit status 1
```
This issue is reported in the following issue.
- containerd#4027
This issue is considered to be the same as the one with errors when
trying to perform many port mappings, such as `nerdctl run -p 80:80 -p 81:81 ~ -p 1000:1000 ...`
The current implementation is processing to create a container with the
information specified in -p to the label.
And as can be seen from the error message, as the number of ports to be
port mapped increases, the creation of the container fails because it
violates the limit of the maximum number of bytes on the containerd side
that can be allocated for a label.
Therefore, this PR modifies the container creation process so that
containers can be launched without having to assign the information
specified in the -p option to the labels.
Specifically, port mapping information is stored in the following path,
and when port mapping information is required, it is retrieved from this
file.
```
<DATAROOT>/<ADDRHASH>/containers/<NAMESPACE>/<CID>/network-config.json
```
Signed-off-by: Hayato Kiwata <haytok@amazon.co.jp>
0 commit comments