Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The container created by Devcontainer keeps resetting /etc/hosts #11439

Closed
3 tasks done
binkoni opened this issue Jul 25, 2023 · 0 comments · Fixed by #11440
Closed
3 tasks done

The container created by Devcontainer keeps resetting /etc/hosts #11439

binkoni opened this issue Jul 25, 2023 · 0 comments · Fixed by #11440
Labels
area/build Build or GithubAction/CI issues type/bug

Comments

@binkoni
Copy link
Contributor

binkoni commented Jul 25, 2023

Pre-requisites

  • I have double-checked my configuration
  • I can confirm the issues exists when I tested with :latest
  • I'd like to contribute the fix myself (see contributing guide)

What happened/what you expected to happen?

What happened

Whenever I reboot my computer, /etc/hosts entries added by Devcontainer are gone

devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . /bin/bash
cat /etc/hosts

#127.0.0.1	localhost
#::1	localhost ip6-localhost ip6-loopback
#fe00::0	ip6-localnet
#ff00::0	ip6-mcastprefix
#ff02::1	ip6-allnodes
#ff02::2	ip6-allrouters
#172.17.0.1	host.docker.internal
#172.17.0.2	be7abe611b1c
#127.0.0.1 dex
#127.0.0.1 minio
#127.0.0.1 postgres
#127.0.0.1 mysql
#127.0.0.1 azurite

reboot
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . /bin/bash
cat /etc/hosts

#127.0.0.1	localhost
#::1	localhost ip6-localhost ip6-loopback
#fe00::0	ip6-localnet
#ff00::0	ip6-mcastprefix
#ff02::1	ip6-allnodes
#ff02::2	ip6-allrouters
#172.17.0.1	host.docker.internal
#172.17.0.2	be7abe611b1c

What I expect

/etc/hosts should be preserved

Why it happens

That's Because Devcontainer's container is running with bridge networking
https://stackoverflow.com/questions/27521678/etc-hosts-file-of-a-docker-container-gets-overwritten

How to fix It

https://code.visualstudio.com/remote/advancedcontainers/start-processes
Add postStartCommand field that adds /etc/hosts entries to devcontainer.json
Add --add-host options as runArgs in devcontainer.json

Version

latest

Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

none

Logs from the workflow controller

none

Logs from in your workflow's wait container

none
binkoni added a commit to binkoni/argo-workflows that referenced this issue Jul 25, 2023
Signed-off-by: Byeonggon Lee <binkoni@gonnux.com>
binkoni added a commit to binkoni/argo-workflows that referenced this issue Jul 25, 2023
Signed-off-by: Byeonggon Lee <binkoni@gonnux.com>
binkoni added a commit to binkoni/argo-workflows that referenced this issue Jul 26, 2023
Signed-off-by: Byeonggon Lee <binkoni@gonnux.com>
terrytangyuan pushed a commit that referenced this issue Jul 27, 2023
Signed-off-by: Byeonggon Lee <binkoni@gonnux.com>
@agilgur5 agilgur5 added the area/build Build or GithubAction/CI issues label Aug 31, 2023
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this issue Mar 12, 2024
Signed-off-by: Byeonggon Lee <binkoni@gonnux.com>
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this issue May 6, 2024
Signed-off-by: Byeonggon Lee <binkoni@gonnux.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Build or GithubAction/CI issues type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants