Container Internet access

For Workers & Pages, what is the name of the domain?

not applicable

What is the issue or error you’re encountering

When creating a new container with the corresponding worker using a go web server which needs acces to the Internet it states that the destination net is not reachable and the DNS is not resolving → so no Internet connection

What steps have you taken to resolve the issue?

It is stated that to enable Internet you need to do either:
class MyContainer extends Container {
defaultPort = 7000;
enableInternet = true;
}
OR
this.ctx.container.start({
enableInternet: true,
});

Both failed and didn’t resolve the issue. Furthermore there is something mentioned in the newly released blogpost (Simple, scalable, and global: Containers are coming to Cloudflare Workers in June 2025) regarding this:

Just as the Durable Object can act as proxy to the container, it can act as a proxy from the container as well. When setting up a container, you can toggle Internet access off and ensure that outgoing requests pass through Workers.

// … when starting the container…
this.ctx.container.start({
workersAddress: ‘10.0.0.2:8080’,
enableInternet: false, // ‘enableInternet’ is false by default
});

// … container requests to ‘10.0.0.2:8080’ securely route to a different service…
override async onContainerRequest(request: Request) {
const containerId = this.env.SUB_SERVICE.idFromName(request.headers[‘X-Account-Id’]);
return this.env.SUB_SERVICE.get(containerId).fetch(request);
}

This method doesnt seem to work like it should, even though trying to send a get request from the go server to that 10.0.0.2:8080 i didn’t receive a response.

My use-case is the following: I created a go web server which should act a sort of API for the typst-cli, so I can send the text representation of a PDF to the server and receive the generated PDF back. The problem is that typst has a big ecosystem of packages, which need to be pulled from their package registry, that’s why the container needs internet access.

Any help would be greatly appreciated!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.