Create a worskpace with several container
Hi,
I'd like to know whether it's possible in coder to create a workspace that contains for example a container where all code resides and gets executed (as usual) and additionally other containers (for example a database container) that can be accessible from the former application container.
Thanks !
Solution:Jump to solution
```tf
data "coder_workspace" "me" {}
resource "docker_network" "me" {
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
}...
7 Replies
<#1232347535817834597>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
You have two options.
1. You set up a template with multiple
docker_container
resources
2. Use Docker in Workspace: https://coder.com/docs/v2/latest/templates/docker-in-workspacesDocker in workspaces - Coder v2 Docs
Use Docker inside containerized templates
Thanks a lot @Atif for your answer , I'm going to try the option 1 you suggest, will the containers have a dedicated network or is this something I have to specify on the template as well?
I have not tried it but you can probably create a network per workspace using
docker_network
resource and then attach your docker_container
resources to that network using
https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs/resources/container#nestedblock--networks_advancedGreat stuff, thanks again Atif !
Solution
Something like that could work.