Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: persist the devtunnel file in a docker volume#15731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

hugodutka
Copy link
Contributor

@hugodutkahugodutka commentedDec 3, 2024
edited
Loading

Addresses#15663.

This PR saves the entire coder home directory in a Docker volume to make the dev tunnel URL persistent across container restarts.

I initially wanted to persist only the config directory, but Docker Compose cannot set permissions on a named volume unless the directory it’s mounted on already exists within the container. The/home/coder/.config directory, however, is not created by default in the Dockerfile. When I attempt to mount it,Docker creates it with root permissions, and Coder cannot write to it. I encounter the following error:

coder-1     | Started HTTP listener at http://0.0.0.0:7080coder-1     | Opening tunnel so workspaces can connect to your deployment. For production scenarios, specify an external access URLcoder-1     | Encountered an error running "coder server", see "coder server --help" for more informationcoder-1     | error: create tunnel: read or generate config: get config path: mkdirall config dir "/home/coder/.config/coderv2": mkdir /home/coder/.config/coderv2: permission denied

Creating the directory in the Dockerfile would resolve the issue for new images but would breakdocker-compose.yml for all existing Coder images. Mounting the entire home directory avoids this problem, but it makes it less clear to admins which files need to be persisted. It’s a trade-off - I believe keeping Docker Compose backwards-compatible is more important, and I hope the added comment clarifies the purpose of the volume for new users.

@hugodutkahugodutka changed the titlefix(docker-compose): persist the devtunnel file in a volumefix: persist the devtunnel file in a docker volumeDec 3, 2024
@hugodutkahugodutka marked this pull request as ready for reviewDecember 3, 2024 16:11
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Makes sense, considering the home is not intended to be used for anything other than config, this approach should work just fine. 👍🏻

@@ -21,6 +21,10 @@ services:
# - "998" # docker group on host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# Use "docker volume rm coder_coder_home" to reset the dev tunnel url (https://abc.xyz.try.coder.app)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
#Use "docker volume rm coder_coder_home" to reset the dev tunnel url (https://abc.xyz.try.coder.app)
#Run "docker volume rm coder_coder_home" to reset the dev tunnel url (https://abc.xyz.try.coder.app).

hugodutka reacted with thumbs up emoji
@hugodutkahugodutka merged commit75f4176 intomainDec 4, 2024
25 checks passed
@hugodutkahugodutka deleted the hugodutka/docker-compose-devtunnel-persistence branchDecember 4, 2024 11:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mafredrimafredrimafredri approved these changes

@johnstcnjohnstcnAwaiting requested review from johnstcn

Assignees

@hugodutkahugodutka

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@hugodutka@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp