#Phrasing for forwarding a port?

1 messages · Page 1 of 1 (latest)

distant bough
#

I'd like to forward an arbitrary port (cue sdk) to the process in the dagger container (ugh). I've successfully forwarded the docker socket and the ssh auth socket, but I get a little confused about the phrasing of how you would forward a port from the machine inward.

The context: unit tests which run via docker-compose. The docker-compose up part begins to work (since the docker socket is forwarded to the dagger container via client: network, and it sorta works, but health checks fail because the health checks are going to "localhost:port" which fails.

I thought you could eg client: network: "http://localhost:4242": connect: dagger.#Socket which may even work for the source, but I'm confused how you would mount it in the target since the other sockets are mounted as files with "dest".

Any suggestions? Is this possible?

true pond
#

Ah actually I think you want the opposite: proxy OUTBOUND from the docker-compose tool running in the DAG, to a port open on the host?

distant bough
#

Yes, I think that's what we're trying to do. Evidently that's possible, so I must be missing something obvious (I'm missing a lot obvious actually, steepish learning curve here, but the potential is marvelous!)

true pond
#

I don’t know enough about docker compose health checks to be really helpful

distant bough
#

Well, that at least lets me know it's possible; the very line: "Currently Dagger can proxy OUTBOUND network connections, from the DAG to the client." That's actually what I want, and I can do it for "sockets which map to a file" (/var/lib/docker.sock, even the env SSH_AUTH_SOCK). So I'm just missing something about how to use client: network: to do that for an arbitrary port on the client (host) (if the host was running a database at port 4242, how would a dagger action open "localhost:4242" and instead connect to that database?

It sure seems possible, and somehow I can't get the phrasing.

#

Ha, in this case since I'm going through docker.#Run, it may be as easy as the ports argument. Silly.

#

...hm, still not quite there (the post I found made it look like a list of ports a la docker, but the current 2.36 version of the universe docker.#Run has it requiring a dagger.#Socket for the frontend and again I don't know how to describe that). Close.

#

(more plainly, what I'm seeing for the definition of a socket address is _#address: string & =~"^(unix://|npipe://).+" for client: networkmeaning a unix socket address and I'm not clear how to use that to forward an arbitrary TCP/IP port through either mounts or the slightly dodgy-sounding docker.#Run ports:

        // Expose network ports
        // FIXME: investigate feasibility
        ports: [name=string]: {
                frontend: dagger.#Socket
                backend: {
                        protocol: *"tcp" | "udp"
                        address:  string
                }
        }