-
Notifications
You must be signed in to change notification settings - Fork 311
Description
I'm trying to develop using a devcontainer with KASM, using the Ubuntu Noble Docker-in-Docker image. However, the devcontainer is failing to build the image due to apt failing to retrieve packages. The error is that apt is unable to resolve any hostnames during the initial image build.
If the apt package install steps are removed from the build process, the image is able to be built and runs. I have confirmed that the final built image does have full network and internet access.
The devcontainer build step is INCREDIBLY annoying to troubleshoot, as the ability to interact with the pre-built system is not possible and the ability to even get messages and information about the system is difficult if not impossible. First, ping is not available, though I have confirmed that DNS at least is not working. I believe networking is not working at all in the pre-build environment on the image. This causes the devcontainer to fail to build because apt fails.
The issue seems to be centered on the build portion using the default docker bridge for its network. I have been able to determine the build image obtains the IP 172.17.0.3 and uses 172.17.0.1 as the gateway. I tried changing this default network by setting "bip" to another IP range in /etc/docker/daemon.json and once I finally figured out how to restart the docker daemon, confirmed the build image was using the new network IP range. Unfortunately, this didn't resolve the issue. I thought it might because I thought the 172.17 ip range may have been conflicting with the KASM hosts docker network, but that didn't turn out to be the case.
To duplicate this issue, create a Ubuntu Noble Docker-in-Docker workspace and launch the workspace.
git clone https://github.com/inventree/InvenTree.git
Launch VS Code and install the devcontainers add-on, then open the cloned folder in VS Code.
The exact process I am trying to follow is documented here https://docs.inventree.org/en/latest/develop/devcontainer/#setupinstallation
Setup/Installation(https://docs.inventree.org/en/latest/develop/devcontainer/#setupinstallation)
Clone the repository (If you want to submit changes fork it and use the url to your fork in the next step)
git clone https://github.com/inventree/InvenTree.git
Open vscode, navigate to the extensions sidebar and search for ms-vscode-remote.remote-containers. Click on install.
Open the cloned folder from above by clicking on file > open folder
vscode should now ask you if you'd like to reopen this folder in a devcontainer. Click Reopen in Container.
If it does not ask you, open the command palette (CTRL/CMD+Shift+P) and search for Reopen in Container.
This can take a few minutes until the image is downloaded, build and setup with all dependencies.
Open a new terminal from the top menu by clicking Terminal > New Terminal
The last line in your terminal should now show the text (venv) at the start of the line
You are done! You now should have a functioning InvenTree development installation
Here is the (default) docker network configuration in the workspace:
default:~/Desktop$ docker network list
NETWORK ID NAME DRIVER SCOPE
f1b76a752a1b bridge bridge local
e13f2eeecdf9 host host local
b6a491c1a9bc none null local
default:~/Desktop$ docker network inspect bridge
[
{
"Name": "bridge",
"Id": "f1b76a752a1b4ffece559a037799aaf59887e404f0b925159f681b310b9e9d21",
"Created": "2025-11-04T23:36:16.156194491-06:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv4": true,
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
Currently I'm thinking the problem is with the com.docker.network.bridge.host_binding_ipv4 option, but that will need to wait until tomorrow.
Ideally, I should be able to develop in a devcontainer without having to create a custom workspace image or modifying the devcontainer settings of the git project. I have confirmed that I am able to launch the devcontainer just fine on the host with the instructions provided.