Docker in Docker docker-compose volume

Hi, I have a Docker in Docker setup with a git repo inside that has a docker-compose.yml. One of the containers has a volume that maps the current folder to a folder inside the container. The issue is that using a Docker in Docker setup, the current folder "." is mapped to the host (which not exists), not the current workspace container. volumes: - '.:/var/www/html' How I can map the current folder (as it would work in a local/host setup)? Thanks.
11 Replies
Codercord
Codercord2y ago
<#1204025709966921780>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
matifali
matifali2y ago
Try using $pwd in place of .
Marc
MarcOP2y ago
same issue, it loads the current directory but of the host, not the current path inside the workspace container
matifali
matifali2y ago
Aren't you running this docker compose file from within the workspace? Then it should translate to your current directory within your workspace
Marc
MarcOP2y ago
I'm running docker compose within the workspace. The issue happens because when using docker in docker, the inner container (workspace) uses the host docker socket when running docker command in it.
matifali
matifali2y ago
Oh so you are running docker in docker by mounting the host docker socket within the container?
nelsonsilva
nelsonsilva2y ago
@Marc do you find any solution for your problem? I am facing the same problem, I must run a docker compose inside my docker workspace and I am having issues with the volumes. Any help is appreciated, thanks in advance. @Atif any sugestion on how to run a docker compose inside a docker workspace? My coder installation is via Docker compose.
matifali
matifali2y ago
Please check https://coder.com/docs/v2/latest/templates/docker-in-workspaces for some possible ways to run docker within workspaces
Docker in workspaces - Coder v2 Docs
Use Docker inside containerized templates
Phorcys
Phorcys2y ago
hey @nelsonsilva, did you figure this out ?
nelsonsilva
nelsonsilva2y ago
Unfortunately no, I had to pause my coder setup development because of company priorities. I will write back as soon as I have news about it. Thanks for asking.

Did you find this page helpful?