C
Coder.com•4mo ago
zztop

"main.tf line 167"

Good evening all! I'm completely new to Coder and I was following the quickstart instructions at https://coder.com/docs/tutorials/quickstart for a Windows 11 Home machine. I got both Coder and Docker installed on my machine, but when I try to Build a workspace I get this error:
Error: failed to read downloaded context: failed to load cache key: invalid response status 403

on main.tf line 167, in resource "docker_image" "main":
167: resource "docker_image" "main" {
Error: failed to read downloaded context: failed to load cache key: invalid response status 403

on main.tf line 167, in resource "docker_image" "main":
167: resource "docker_image" "main" {
I found at least one other thread running into that error just a couple months back , but in their case it seems to have happened on a non-windows machine and I could not make up anything from their resolution - apparently some changes to a Docker file that find no trace of on the windows machine. I tried on a completely different windows machine and I got exactly the same result. Where do I start troubleshooting that? Please yelp!
Coder quickstart - Coder Docs
Try it out for yourself
From An unknown user
From An unknown user
28 Replies
Codercord
Codercord•4mo ago
<#1307207030288814151>
Category
Help needed
Product
code-server
Platform
Windows
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys•4mo ago
@zztop could you send your dockerfile over?
zztop
zztopOP•4mo ago
Attached the two source files from the template + the failing build log. Thanks for taking a look, Theo!
Phorcys
Phorcys•4mo ago
can you try to run docker image rm ubuntu and retry?
zztop
zztopOP•4mo ago
That's what I get when I try it from the Windows Power Shell:
PS C:\> docker image rm ubuntu
Error response from daemon: No such image: ubuntu:latest
PS C:\> docker image rm ubuntu
Error response from daemon: No such image: ubuntu:latest
Or did you mean I need to run it in another console?
Phorcys
Phorcys•4mo ago
I meant running that on server that hosts the Docker instance that's used by your Coder instance
zztop
zztopOP•4mo ago
That's right. The Docker instance is hosted on my Windows machine. That's what my Docker terminal looks like. With the failing command printed at the bottom:
No description
zztop
zztopOP•4mo ago
(Apologies for all the hand holding that I require)
Phorcys
Phorcys•4mo ago
can you try to docker build the Dockerfile manually?
zztop
zztopOP•4mo ago
It took me embarrassingly long to figure out how. Here's the result (attached log)
zztop
zztopOP•4mo ago
(I'm stepping away from my laptop for most of the morning. Thanks for your help so far. Hopefully we can pick up the troubleshooting later again...)
Phorcys
Phorcys•4mo ago
@zztop could you retry building the workspace?
zztop
zztopOP•4mo ago
(I'm on and off the whole day today, sorry) I just retried building a workspace from the template, but I still get the same error Overall, I get the feeling that the vanilla quick-start process for Coder might be currently broken for Windows machines (again, I ran into that on two separate PCs, one of which I actually re-imaged overnight for a good measure). So I'd be surprised if there are no other Windows users running into that now (or perhaps there are not that many Windows users for Coder in the first place?). I betcha that if a more knowledgeable person tried to install this on Windows today, they would run into the same problem but they could quickly figure out which part of the config needs some tweaking. @Phorcys , the other thing I was wondering if you'd have some guidance how to try is, to try manually running and tweaking the terraform script (main.tf) from within the docker instance. The error is happening while executing that script, IIUC the sequence of build actions.
Phorcys
Phorcys•4mo ago
Windows users are more rare but it works properly in my machine and I never ran into this issue this seems to be a Docker-specific issue you could use the terraform CLI but honestly I'm not sure that'd be worth your time how are you running Coder? docker-compose?
zztop
zztopOP•4mo ago
Hey Theo, thanks for sticking with me. I really appreciate it. My son and I made some great progress installing the Coder on Ubuntu. So far, we created two user workspaces and were able to log in from different machines, incl. from a Chromebook. So far so good. Now we are looking into installing Java compiler - haven't figured that part out. I'm probably going to give up attempting the Windows installation for now, though it would have been great if we figured it out.
Phorcys
Phorcys•4mo ago
i'll retry it on my end as well I am thinking there could be an issue related to this
zztop
zztopOP•4mo ago
I'm starting coder directly in the powershell of the host machine (i.e., my Windows 11 Home laptop) with this command:
PS C:\Users\vesel> coder server
PS C:\Users\vesel> coder server
This is how I understood the instructions from https://coder.com/docs/tutorials/quickstart
Coder quickstart - Coder Docs
Try it out for yourself
From An unknown user
From An unknown user
Phorcys
Phorcys•4mo ago
oh yeah i'm not sure that'll work
zztop
zztopOP•4mo ago
Ha! Is there anything else I can try instead? Are you suggesting I could start the coder server from within the docker instance?
Phorcys
Phorcys•4mo ago
not really but basically the way this works is that by default it'll look for a docker socket at /var/run/docker.sock the default is probably different on windows but I think that's why you're getting that error well, i'm not sure though because it should fail differently let me try yeah so @zztop, while i reproduce, you could try deploying coder inside WSL with WSL integration enabled in Docker desktop (enabled by default) yeah it works properly on my end (Coder v2.17.2 running on Windows, with Docker desktop alongside) so i'm not sure what's up with that
zztop
zztopOP•4mo ago
Thanks for trying hard, Theo. I poked with few more options here, including tried building a Docker build from the Dockerfile posted in the "Tailscale in workspace" thread a few months ago - to no avail. Given my lack of experience with all of these systems involved, I don't think I can crack it 🙂 We'll just stick with our Coder on Ubunto option that seems to work fine.
Phorcys
Phorcys•4mo ago
sounds good! let me know if you ever retry it! to me you're doing everything right but there must be a quirk with your setup that i didn't spot
Su凶
Su凶•4mo ago
Hi, I also encounter exactly the same issue on my Windows 11 machine. After changing some options in the Docker Desktop Setting, the workspace can be built without error. Below are the options that I have changed in the Docker Destlop Setting: General * Expose daemon on tcp://localhost:2375 without TLS -> enable * Use the WSL 2 based engine * Add the *.docker.internal names to the host's /etc/hosts file (Requires password) -> enable * Use containerd for pulling and storing images -> disable Resoure / Network * Enable host networking -> enable I'm not sure what options really do the work, just for your reference By the way, I'm trying Coder Tutorial with following software: * Coder v2.17.2+0598aec * Docker Desktop 4.35.1 * Windows 11 Professional 23H2
Phorcys
Phorcys•4mo ago
hey @Su凶 you should be able to toggle WSL integration in Docker desktop and it'll make the Docker socket available in /var/run/docker.sock without the need for a TCP one thanks for the info!
Su凶
Su凶•4mo ago
Hi @Phorcys The WSL integration option is enabled by default when the Docker Desktop is installed on my machine. Without changing the options mentioned earlier, the workspace build will fail. The WSL distro in my machine is docker-desktop, which seems created by the Docker Desktop. The docker socket file does not exist in /var/run folder after i run wsl.exe 😂
Phorcys
Phorcys•3mo ago
glad you got it solved :-)
Codercord
Codercord•3mo ago
@Phorcys closed the thread.
zztop
zztopOP•2mo ago
Hey, I also was pocking with it and made it work, but without knowing anything about Su凶's success. The way it worked for me was apparently simpler, but there's one common denomator: * I ran coder server from a PowerShell which I started As administrator * I started the Docker Desktop As administrator as well * Finally, I disabled containerd (which was recommended here: https://stackoverflow.com/questions/79255836/terraform-docker-image-resource-fails-with-invalid-response-status-403). This seems to be the common denominator. It looks like I need Docker to run as administrator if coder server runs as administrator. I got the feeling that if I run both as me, all might still work, but haven't tested it yet.
Stack Overflow
Terraform docker_image Resource Fails With "invalid response status...
I am trying to get Terraform set up to build a Docker image of an ASP.NET Core Web API to use in a tech demo. When I try to terraform apply I get the following error: docker_image.sample-ecs-api-im...

Did you find this page helpful?