Title: Bug: The `examples/docker-local` template does not work out-of-the-box · Issue #1345 · coder/coder · GitHub
Open Graph Title: Bug: The `examples/docker-local` template does not work out-of-the-box · Issue #1345 · coder/coder
X Title: Bug: The `examples/docker-local` template does not work out-of-the-box · Issue #1345 · coder/coder
Description: This could either be seen as a bug, documentation improvement or both. OS Information OS: Ubuntu 20.04.4 LTS running on Coder v1 coder --version: v0.5.4-devel+ad8d9dd Steps to Reproduce Note that here we are running coder in production m...
Open Graph Description: This could either be seen as a bug, documentation improvement or both. OS Information OS: Ubuntu 20.04.4 LTS running on Coder v1 coder --version: v0.5.4-devel+ad8d9dd Steps to Reproduce Note that h...
X Description: This could either be seen as a bug, documentation improvement or both. OS Information OS: Ubuntu 20.04.4 LTS running on Coder v1 coder --version: v0.5.4-devel+ad8d9dd Steps to Reproduce Note that h...
Opengraph URL: https://github.com/coder/coder/issues/1345
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug: The `examples/docker-local` template does not work out-of-the-box","articleBody":"This could either be seen as a bug, documentation improvement or both.\r\n\r\n## OS Information\r\n\r\n- OS: Ubuntu 20.04.4 LTS running on Coder v1\r\n- `coder --version`: `v0.5.4-devel+ad8d9dd`\r\n\r\n## Steps to Reproduce\r\n\r\nNote that here we are running `coder` in `production` mode.\r\n\r\n1. Set up postgres database\r\n2. Run coder server: `CODER_PG_CONNECTION_URL=\"postgres://...\" coder server`\r\n3. Run `coder login http://127.0.0.1:3000`\r\n4. Create template from docker-local example: `coder templates create docker-local -d ~/src/coder/examples/docker-local`\r\n5. Create workspace: `coder create -t docker-local my-test`\r\n\r\n## Expected\r\n\r\nThe `coder create` and `coder ssh my-test` commands should just work™️.\r\n\r\n## Actual\r\n\r\n(**Note:** I originally created this issue due to silent failure of `coder create` making it seem like it's just taking a long time for the workspace to start up, but that seems to be related to https://github.com/coder/coder/issues/1036 and possibly fixed?)\r\n\r\nRunning `coder create --template=docker-local my-test` gives an error:\r\n\r\n```\r\n This template has customizable parameters. Values can be\r\n changed after create, but may have unintended side effects\r\n (like data loss).\r\n\r\nvar.docker_image\r\n What docker image would you like to use for your workspace?\r\n\r\n > codercom/enterprise-base:ubuntu\r\n\r\n┌─────────────────────────────────────────────────────────────┐\r\n│ Workspace Preview │\r\n├─────────────────────────────────────────────────────────────┤\r\n│ RESOURCE STATUS ACCESS │\r\n├─────────────────────────────────────────────────────────────┤\r\n│ docker_container.workspace ephemeral │\r\n│ └─ dev (linux, amd64) coder ssh my-test │\r\n├─────────────────────────────────────────────────────────────┤\r\n│ docker_volume.coder_volume persistent │\r\n└─────────────────────────────────────────────────────────────┘\r\n> Confirm create? (yes/no)\r\n✔ Queued [45ms]\r\n✔ Setting up [6ms]\r\n⧗ Starting workspace\r\n Terraform 1.1.9\r\n coder_agent.dev: Plan to create\r\n docker_volume.coder_volume: Plan to create\r\n docker_container.workspace[0]: Plan to create\r\n Plan: 3 to add, 0 to change, 0 to destroy.\r\n coder_agent.dev: Creating...\r\n coder_agent.dev: Creation complete after 0s [id=990e17cb-62a9-4227-9d7b-247b669321ac]\r\n docker_volume.coder_volume: Creating...\r\n docker_volume.coder_volume: Creation complete after 0s [id=coder-coder-my-test-root]\r\n docker_container.workspace[0]: Creating...\r\n docker_container.workspace[0]: Creation errored after 1s\r\n Error: container exited immediately\r\n\r\n✘ Starting workspace [2014ms]\r\nexit status 1\r\n```\r\n\r\nBut there is no indication as to what's wrong. With an older version of `coder server` (with the silent failure mentioned above), the docker container is not cleaned up and we can inspect it's log:\r\n\r\n```\r\n❯ docker logs coder-coder-my-test-root\r\ncurl: (7) Failed to connect to 127.0.0.1 port 3000: Connection refused\r\n```\r\n\r\nWe see that the container didn't successfully complete its bootstap due to inability to download the agent (from a bad access URL).\r\n\r\nThere are ~~four~~ three things to observe here:\r\n\r\n1. The access URL is unspecified and defaulting to `127.0.0.1` which is likely not what we want to propagate inside the workspace being created inside the Docker container\r\n2. The coder server is not listening on the Docker interface (`--address 0.0.0.0:3000` would help)\r\n3. If this was a `--dev` instance we might not run into this issue when a tunnel is created\r\n4. ~~The `curl` error (and subsequent container exit) did not propagate and result in `coder server` being able to inform the user that the bootstrap failed (terraform issue? fixed as per observations in https://github.com/coder/coder/issues/1036?)~~\r\n\r\n\r\n## Notes\r\n\r\nThere are a few ways we could improve upon this, some ideas:\r\n\r\n1. Improve documentation for `examples/docker-local` to mention all knobs that need to be tuned\r\n2. Detect server/template configuration mismatches that can never work (e.g. the `127.0.0.1` access URL is not likely to work inside any sort of container system, nor is `coder server` listening on `127.0.0.1`)\r\n3. Better error reporting in the cli (could we show the container error log?)","author":{"url":"https://github.com/mafredri","@type":"Person","name":"mafredri"},"datePublished":"2022-05-09T13:29:00Z","url":"https://github.com/coder/coder/issues/1345"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3963c0bd-8d3a-7456-0399-86f255f2ad99 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC02:E0ADF:874E31:AB64DA:6B01D275 |
| html-safe-nonce | 5a707e6b8160c863fb8224b19c39715b2393603ccc6e4153123effc6c1aa6999 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzAyOkUwQURGOjg3NEUzMTpBQjY0REE6NkIwMUQyNzUiLCJ2aXNpdG9yX2lkIjoiNzU4NDg1NjAyNTQwOTM3Njg4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c0050ed1035555c8e71358f06064292c746f1c0a39be3196870acb24f000c43c |
| hovercard-subject-tag | issue:1229712376 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/1345/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9ebf75e360963618d778f1ea689bd0dc512c407714f68cd8557ac9a28ff15337/coder/coder/issues/1345 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9ebf75e360963618d778f1ea689bd0dc512c407714f68cd8557ac9a28ff15337/coder/coder/issues/1345 |
| og:image:alt | This could either be seen as a bug, documentation improvement or both. OS Information OS: Ubuntu 20.04.4 LTS running on Coder v1 coder --version: v0.5.4-devel+ad8d9dd Steps to Reproduce Note that h... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mafredri |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width