#Trouble connecting to localhost:3030 from docker image

1 messages · Page 1 of 1 (latest)

fathom obsidian
#

I'm using trigger with remix running on port 3000, and trigger server running on 3030.

It seems like trigger running in docker has trouble connecting to localhost:3000

triggerdotdev           | {"url":"http://localhost:3030/api/v1/endpoints","timestamp":"2024-03-30T21:53:06.587Z","name":"webapp","message":"action","level":"info"}
triggerdotdev           | {"url":"http://localhost:3030/api/v1/endpoints","endpoint":{"url":"http://localhost:3000/api/trigger","id":"cohortable-Zojn"},"timestamp":"2024-03-30T21:53:06.603Z","name":"webapp","message":"Creating endpoint","level":"info"}
triggerdotdev           | {"url":"http://host.docker.internal:3000/api/trigger","error":{"cause":{"errno":-111,"code":"ECONNREFUSED","syscall":"connect","address":"192.168.65.254","port":3000}},"timestamp":"2024-03-30T21:53:06.613Z","name":"webapp","message":"Error while trying to connect to endpoint","level":"debug"}
triggerdotdev           | {"url":"http://localhost:3030/api/v1/endpoints","error":"Could not connect to endpoint http://host.docker.internal:3000/api/trigger","timestamp":"2024-03-30T21:53:06.613Z","name":"webapp","message":"Error creating endpoint","level":"debug"}

Not sure why http://host.docker.internal:3000/api/trigger isn't working.

minor oracle
#

@thick pike or @surreal fossil might be able to provide some guidance here as I think they might run Trigger.dev locally inside docker.

I'm pretty sure it's because it needs to be an address that works for two-way communication. The Remix server needs to be able to address the Trigger.dev service but also the Trigger.dev service needs to be able to call into the Remix service. This is why we create a tunnel for local development when using the cloud product.

surreal fossil
#

It's usually recommended you expose them over a common network in docker or to your local host, in which case you'd simply target the container name and not a core internal hostname for docker.

thick pike
#

When I was testing with everything on one machine, I would disable the tunnel in the cli and then wire things up using the host/container addresses from the docker bridge

#

As far as why the hostname isn't working, are you using docker or a different runtime like podman

surreal fossil
#

also off topic but if you have a spare raspberry pi laying around, using that is always a good idea for development with OS apps (that's what i do 🙂 )

fathom obsidian
#

this is direct from your github docker repo.

#

running docker desktop 426.1

surreal fossil
#

We're not trigger staff 😅 but can you share your config for trigger? How you connect etc

fathom obsidian
#

hah, its nothing out of the box. standard remix template

#

@minor oracle I maybe an outlier here but you shouldn't need a cloud service to run jobs on laptop. I liked the fact that you guys supported docker, unfortunately I couldn't get it to work.

surreal fossil
#

You don't need to use a cloud service

#

While using the dev command, enter the root URL for your local instance with a -t option

#

It'll skip the tunnel and use your endpoint instead

#

@fathom obsidian

#

So in this case, docker host internal url with the port or localhost with the port

#

of course with http