Multiple containers in one template
This is probably really silly but I've never used Terraform and barely used Docker before so I'm going in a bit blind. I'm trying to build a workspace template that has an application container as well as a database container. I'm trying to simply use the latest MariaDB image from docker hub.
The application container works fine, but the database container never starts. It shows up in the UI, but just shows an error that it did not start in time. I can't figure out how to debug this issue since there are no details, logs, or any further information as to how far it got in the process.
I'm also not sure if each container needs its own
coder_agent
resource or if I'm meant to reuse it. In my current tf file, I have one for each container, but I have tried reusing the "main" agent with no luck.
Attached is my tf file for the workspace.
I appreciate your help10 Replies
<#1232887845866438766>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Hi. Does this answer your question?
https://discord.com/channels/747933592273027093/1232347535817834597
Unfortunately no, that does not help
it seems like the issue is that the agent for the second docker container isn't connecting? At least thats what I can intrepret from what I'm seeing in the UI
It shows the container under resources but it never connects
but again I don't really know how to debug that
Why do you need an agent in all containers?
1 agent in the main dev container should be enough.
Your other containers should be accessible from the main container if you have joined them to the same docker network as shown in that tread.
I suppose it isnt required
just useful (to see stats and the like, since no information is displayed for a container without an agent) but if thats not possible then I can take that out
how can I discover what the other container's address is on the docker network?
in docker compose it would basically create pseudo dns entries for each container, I assume there is something similar here?
I assume the hostname works for this purpose
I'm really not sure what im doing wrong but the other containers are not resolvable by their hostname
I'm not sure if thats intended (is it only possible to reference another containers IP via env variable?)
this has been resolved
Woukd help others if you can share your final working solution
https://github.com/bamhm182/Coder-Templates/tree/wip-initial/podman-coder-ws
This is a solution I have been using. It only has two different containers, but that's all I have needed for the time being.
GitHub
Coder-Templates/podman-coder-ws at wip-initial · bamhm182/Coder-Tem...
Contribute to bamhm182/Coder-Templates development by creating an account on GitHub.
@Atif closed the thread.