feat: Add optional Docker extraHosts (part 2)#485
Draft
MAHDTech wants to merge 3 commits intojunobuild:mainfrom
Draft
feat: Add optional Docker extraHosts (part 2)#485MAHDTech wants to merge 3 commits intojunobuild:mainfrom
MAHDTech wants to merge 3 commits intojunobuild:mainfrom
Conversation
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.
Overview
NOTE: This is part 2/2 and cannot be merged without part 1 as it requires the
package.jsonupdated with the new@junobuild/configversion to be completed.This PR adds an additional configuration item to the Docker options called
extraHostsUse case
This is useful for making host-machine services reachable from within the container under a stable DNS name such as
host.docker.internal.There are many examples but the main use case for me is working with EVM chains.
If you are working with EVM chains and need
Anvilrunning locally by default Canisters running within SkyLab cannot accesslocalhost.With this change you can deploy the dfinity evm-rpc-canister into the Juno Pocket IC and then make connections like this
You now have end-to-end IC-EVM development fully local 🥳
Example
Here is a snippet from an example
juno.config.mjsHow it works
When the container start the following container arguments can be seen by running
docker inspect juno-skylabHow to test it
Let's say for example you have a web service running on
localhost:8545you can do a quick test like this;This shows the connection can now hit local services via the Docker Gateway using the neat trick that Docker provides with
host.docker.internalRelated
Part 1