Repository navigation
chore: remove docker host from docker-compose - #1596
Merged
Merged
Conversation
johnstcn
approved these changes
May 19, 2022
bpmct
commented
May 19, 2022
Comment on lines
+84
to
+86
| # Use the docker gateway if the access URL is 127.0.0.1 | ||
| command = ["sh", "-c", replace(coder_agent.dev.init_script, "127.0.0.1", "host.docker.internal")] | ||
| env = ["CODER_AGENT_TOKEN=${coder_agent.dev.token}"] |
Member
Author
There was a problem hiding this comment.
@kylecarbs @johnstcn This feels hacky, but seems to address all scenarios:
- ✅ Proper access URL (https://127.0.0.1:7080) on
coder server"welcome" message - ✅ docker-compose example just works with Docker examples
- ✅ Non docker-compose deployments with a proper access URL remain working with the Docker example (no hardcoded values)
Emyrk
approved these changes
May 19, 2022
Emyrk
left a comment
Member
There was a problem hiding this comment.
I don't think this is too bad. 👍
johnstcn
approved these changes
May 19, 2022
| command = ["sh", "-c", coder_agent.dev.init_script] | ||
| env = ["CODER_AGENT_TOKEN=${coder_agent.dev.token}"] | ||
| # Use the docker gateway if the access URL is 127.0.0.1 | ||
| command = ["sh", "-c", replace(coder_agent.dev.init_script, "127.0.0.1", "host.docker.internal")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There isn't really a great solution to get docker-compose working locally:
❌ use 127.0.0.1 as access URL for docker
❌ use
--network=hoston containers in the template:8080❌ add host.docker.internal to docker-compose:
coder servercommand❌ add host.docker.internal to the Docker templates.
🤔 admin parameter for access URL in Docker templates
✅ this hack (override and replace localhost access URL in Docker start script)