Description
What is the problem you're trying to solve
I'm currently refactoring the process of handling flags for the (container) run command. However, it is very complex and I would like to discuss it further.
Describe the solution you'd like
First, we should split the createContainer
function into smaller functions. As seen in the code at https://github.com/containerd/nerdctl/blob/1bbfe6930c56f3d69fe05b300f7c2817b828c024/cmd/nerdctl/container_run.go#L408-753
We will divide it into three tasks:
- Move all helper functions to
pkg/cmd/*util
; - Add a function
processInternalLabels
; - Move all flag retrieval to
processCreateContainerFlags
.
Next, we will move createContainer
to pkg/cmd/containerutil
.
Finally, we will create ContainerRunOptions
in pkg/api/types/container_types.go
and Run
in pkg/cmd/container/run.go
.
Due to the complexity of the createContainer
function and its numerous helper functions, it will take more time to handle.
@AkihiroSuda @djdongjin @Zheaoli , WDYT? Can you share your ideas?
Additional context
No response