Devcontainer starting is taking really long / multiple times building the Dockerfile?
Hi,
I have created a template from the starter "Docker (Devcontainer)" one and just selected home assistant for testing purposes. Creating the workspace takes really long and from the logs it seems like its building the dockerfile multiple times? Is this intended?
21 Replies
<#1331335238281986169>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
it does seem like the devcontainer is being built multiple times, i will try to reproduce the bug
that would be great! for me this happens with every devcontainer every time
even if it's not homeassistant?
yes
have you made any edits to the template?
but whats weird is that the logs for the second and third build appear at once
there you can see that after the logs close automatically there are like 200 lines more
i'm not 100% sure it's actually building it multiple times, it might just be a bug in how we handle logs
how long does it take from clicking start to the workspace being available?
I can reproduce on our internal instance
pretty weird
I also ran into this issue, that's why build image from devcontainer.json takes time.
Around 4 minutes i think
any updates?
hello, sorry for the delay
to me, 4 minutes seems "alright", i have not had the time to properly look into it, but i will chat with our engineers about this this week
i'll keep you updated
thanks
@Cian are you able to help troubleshoot this?
@Greenman999 I'm fairly sure it's just the logs being shown multiple times by the UI for some reason. I was able to reproduce it just now using our
docker-compose
setup in coder/coder
with the same template, building the home-assistant image.
1) What version of Coder are you running? I can see the version of Envbuilder you're using from the log output.
2) Do you get the same behaviour if you hit https://$CODER_DEPLOYMENT/api/v2/workspaceagents/$WORKSPACE_AGENT_ID/logs
directly?
Note: You'll need to hit https://$CODER_DEPLOYMENT/api/v2/users/$YOUR_USERNAME/workspace/$WORKSPACE_NAME
and look for agent_id
to get the parameter for $WORKSPACE_AGENT_ID
).
That endpoint also returns the JSON-formatted logs which includes entry IDs and timestamps, so duplicates should be readily apparent there. If the container is really being built twice, you should see the string "Built image!" show up twice.
3) Do you get the same behaviour if you view the logs for the envbuilder container via the Docker CLI (docker logs container-name-goes-here
)?
3) If you refresh the workspace page, do you get the same number of logs? I've seen multiples of the logs before refresh, and the correct number after refresh.
Under the hood, when you expand the logs drawer, we send a GET to fetch all the currently persisted logs, and we then open a websocket to /logs?follow&after=$LAST_LOG_ID
. It's possible we're just not updating $LAST_LOG_ID
correctly in the UI.
For future reference, 4 minutes is not an unexpected amount of time for Envbuilder to build a non-trivial container from scratch. There are some ways to make this go faster, but the underlying build tool (kaniko) is fundamentally single-threaded and operates completely in userspace, meaning that it can't use nice things like overlayfs 😦I went ahead and created an issue with my observations: https://github.com/coder/coder/issues/16355
Please feel free to add any other relevant context you may have!
GitHub
bug: ui: workspace build logs duplicated during build process · Iss...
Problem Coder version 2.18.5 When building a template that uses an external log source (e.g. envbuilder), we can observe the following: During build process, logs increment normally to $LAST_LOG_ID...
Thanks a lot!
1) v2.18.4+6125358
2) Correct number of logs
3) I'm not really sure, sorry
4) After refresh the correct amount appears
Yep, with point 4) that's basically confirmation to me that you're running into the same issue
FYI: marking this as "to-github"