[draft] feat(portforward): Add SSHD module + Ability to port forward#2467
[draft] feat(portforward): Add SSHD module + Ability to port forward#2467JulienBreux wants to merge 2 commits intotestcontainers:mainfrom
Conversation
Signed-off-by: Julien Breux <julienbreux@google.com>
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| } | ||
|
|
||
| // WithRootPassword sets the options | ||
| func WithOptions(opts []string) Option { |
There was a problem hiding this comment.
| func WithOptions(opts []string) Option { | |
| func WithCommandOptions(commandOption []string) Option { |
| // WithRootPassword sets the options | ||
| func WithOptions(opts []string) Option { | ||
| return func(o *options) { | ||
| o.Options = opts |
There was a problem hiding this comment.
| o.Options = opts | |
| o.CommandOptions = commandOptions |
| req := testcontainers.ContainerRequest{ | ||
| Image: defaultImage, | ||
| ExposedPorts: []string{defaultPort}, | ||
| // WaitingFor: wait.ForLog("* Ready to accept connections"), |
| } | ||
|
|
||
| applyRootPassword(settings.RootPassword)(&genericContainerReq) | ||
| applyCommandOptions(settings.Options)(&genericContainerReq) |
There was a problem hiding this comment.
| applyCommandOptions(settings.Options)(&genericContainerReq) | |
| applyCommandOptions(settings.CommandOptions)(&genericContainerReq) |
| _, err := testcontainersshd.RunContainer(ctx, opts...) | ||
| require.NoError(t, err) | ||
|
|
||
| // @TODO: Test the forwarding container <> host |
|
In progress log: |
|
Hi @JulienBreux our idea is to have the sshd container as part of the internals of the library, so the users just set, e.g., a field in the request struct with the list of ports needed by the container, and the library automatically spins up the sshd container under the hood, forwarding those ports to the container through the sshd server container. req := testcontainers.GenericContainerRequest{
ContainerRequest: testcontainers.ContainerRequest{
Image: "alpine:3.17",
HostAccessPorts: []int{3000, 8080},
}
}I'm currently working on that approach. |
Hi, don't hesitate, if I can help. |
|
Closed by #2471 |
What does this PR do?
Rel: #2212
Why is it important?
To call the host from a container inside a testcontainers container.
Related to Microcks stuff.
(because a Microcks async minion had to call a host development webserver for example)
Related issues
How to test this PR
Use
.WithAccessToHost(true)