create my first custom image

Now that I have a running coder in my Kube and tested it with base template, I need to customize it to fit my usage. I was previously using Gitpod for this and I already have a docker image and it is pushed in my registry. but I always end with workspaces:
Workspace is unhealthy

Your workspace is running but 1 agent is unhealthy.
Workspace is unhealthy

Your workspace is running but 1 agent is unhealthy.
I also started from scratch with a "custom" image only containing:
FROM codercom/enterprise-minimal:ubuntu-20240617
FROM codercom/enterprise-minimal:ubuntu-20240617
What do I miss in the process? Is there a dedicated guide or article on how to write a custom docker image for Coder?
16 Replies
Codercord
Codercord6mo ago
<#1252203647350210671>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Scott
Scott6mo ago
What does your template look like @Thierry Chantier?
TitiMoby
TitiMobyOP6mo ago
MrPeacock
MrPeacock6mo ago
We are using manjaro based images. There is nothing special to consider. Could you dump the logs from container?
TitiMoby
TitiMobyOP6mo ago
You mean logs from the corresponding Kubernetes pod or there is a mechanics I’m not aware directly from Coder?
Scott
Scott6mo ago
Yeah, he means the workspace container. If I remember correctly, in order for the pods to work outside the coder workspace, I had to also give the coder service account cluster wide admin permissions. Not sure that is your problem, but maybe? Or, try using the coder workspace as the workspace for the pod's creation to see if it runs correctly in that workspace. Just guesses on my part though.
TitiMoby
TitiMobyOP6mo ago
mmm, when I start a workspace, the corresponding pod stays in status
so something is wrong with my registry I guess.
ok, I pushed a minimal image on DockerHub and it works. So I guess my problem is in the way to connect to a private registry
I don't get what's wrong.
First, I declared the provider
so something is wrong with my registry I guess.
ok, I pushed a minimal image on DockerHub and it works. So I guess my problem is in the way to connect to a private registry
I don't get what's wrong.
First, I declared the provider
docker = { source = "kreuzwerker/docker" version = "3.0.2" }
then the auth part:
then the auth part:
provider "docker" { registry_auth { address = "bdmxla3s.gra7.container-registry.ovh.net" username = "XXXXX" password = "YYYYY" } }``` I used the simple name/password for now, it will be replaced by some Kube magic after first step
Phorcys
Phorcys6mo ago
hey @Thierry Chantier, the reason this is not working is because the terraform Docker provider and Kubernetes provider don't work with eachother The Docker provider is used for connecting to a Docker socket whereas the Kubernetes one connects to the Kubernetes API
TitiMoby
TitiMobyOP6mo ago
In the template, if I need to use an image from a private docker registry, what do I need to call? (could not find an article or a documentation on this precise point but I may have missed it)
Phorcys
Phorcys6mo ago
it seems you want to use image_pull_secrets in the Deployment/Pod
Phorcys
Phorcys6mo ago
you might need to define a secret resource first
TitiMoby
TitiMobyOP6mo ago
In any case, do I need to define a docker provider to pull the image? That was my understanding
Phorcys
Phorcys6mo ago
no, that is only needed if you're actually using Docker directly in your case everything shall be done via the k8s provider
TitiMoby
TitiMobyOP5mo ago
due to a series of conferences, I won't have enough time to explore more here. I close this one and will open a new one if useful later. Thanks a lot.
Codercord
Codercord5mo ago
@Thierry Chantier closed the thread.
Want results from more Discord servers?
Add your server