You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/containers/local-dev.mdx
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,3 +44,27 @@ You may prefer to set up your own code watchers and reloading mechanisms, or mou
44
44
into the local container images to sync code changes. This can be done, but there is no built-in
45
45
mechanism for doing so in Wrangler, and best-practices will depend on the languages and frameworks
46
46
you are using in your container code.
47
+
48
+
## Troubleshooting
49
+
50
+
### Exposing Ports
51
+
52
+
In production, all of your container's ports will be accessible by your Worker,
53
+
so you do not need to specifically expose ports using the [`EXPOSE` instruction](https://docs.docker.com/reference/dockerfile/#expose) in your Dockerfile.
54
+
55
+
But for local development you will need to declare any ports you need to access in your Dockerfile with the EXPOSE instruction; for example: `EXPOSE 4000`, if you will be accessing port 4000.
56
+
57
+
If you have not exposed any ports, you will see the following error in local development:
58
+
59
+
```txt
60
+
The container "MyContainer" does not expose any ports. In your Dockerfile, please expose any ports you intend to connect to.
61
+
```
62
+
63
+
And if you try to connect to any port that you have not exposed in your `Dockerfile` you will see the following error:
64
+
65
+
```txt
66
+
connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
67
+
```
68
+
69
+
You may also see this while the container is starting up and no ports are available yet. You should retry until the ports become available.
70
+
This retry logic should be handled for you if you are using the [containers package](https://github.com/cloudflare/containers/tree/main/src).
0 commit comments