Skip to content

Commit

Permalink
chore: configure docker during startup instead of during image building
Browse files Browse the repository at this point in the history
The reason for this change is that /etc/resolv.conf is reset when the
container is started, so the DNS configuration is lost.
  • Loading branch information
giovannibaratta committed Mar 3, 2024
1 parent 7fe614a commit 1ecac38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"onCreateCommand": {
"install-dependencies": "/bin/bash ./.devcontainer/install_dependencies.sh || echo 'Failing to install dependencies'",
"install-yarn": "/bin/bash ./.devcontainer/install_yarn.sh || echo 'Script install_yarn failed'",
"configure-jekyll": "/bin/bash ./.devcontainer/configure_jekyll.sh || echo 'Jekyll configuration failed'",
"configure-jekyll": "/bin/bash ./.devcontainer/configure_jekyll.sh || echo 'Jekyll configuration failed'"
},
"postStartCommand": {
"configure-docker": "/bin/bash ./.devcontainer/configure_docker.sh || echo 'Docker configuration failed'"
},
"features": {
Expand Down
6 changes: 5 additions & 1 deletion .devcontainer/configure_docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash

docker network create host-network
if ! docker network list | grep host-network ; then
docker network create host-network
else
echo "host-network already exists. Skipping creation."
fi

# Forward DNS queries to CoreDNS
original_content=$(cat /etc/resolv.conf)
Expand Down

0 comments on commit 1ecac38

Please sign in to comment.