
onStart() and the other lifecycle hooks only fire when you use startAndWaitForPorts() and onStart fires when the container is started or the container and the port is ready?env is not defined in the worker logs when I use thiscontainer.fetch that should do the trick?defaultPort?: Optional default port to use when communicating with the container. If not set, you must specify port in containerFetch calls, or use switchPort.So if not using containerFetch (and not using default port), use normal fetch like:
container.fetch(switchPort(request, port))
**Do not use 'containerFetch' when trying to send a Request object with a websocket, until this issue is addressed. You can overcome this limitation by doing: container.fetch(switchPort(request, port))https://github.com/cloudflare/containers/tree/main
AssertionError: Build ID should be set if containers are defined and enabled when running integration tests with containers enabled?
--build-args or something similar when building a Dockerfileimage_vars in the Wrangler config under containersARG or something like thatexport default {
async fetch(request, env) {
let container_id = request.cf?.colo || request.cf?.region || "default";
return getContainer(env.MY_CONTAINER, container_id).fetch(request);
},
};{
"containers": [
{
"class_name": "MyContainer",
"image": "./Dockerfile",
"max_instances": 10,
"instance_type": "basic",
"image_vars": {
"FOO": "BAR"
}
}
]
}