Docker on remote host: How to bind volumes correctly


i want to work with docker on a remote host. I can connect to the remote docker daemon and almost everything works fine!

Docker settings:

Remote Interpreter:


I seems like that i have a problem in my mappings which i dont understand. Files dont appear in my /var/www/html folder in my container on the remote machine.


I tried volume binding like i did when i had docker installed locally on my laptop ( which did not work obviously )

Because this maps the docker container /var/www/html folder to /Users/martin/PhpstormProjects/dev2.0 on the remote host but not on m laptop

The question is: How can i bind my local folder on my Laptop with the /var/www/html folder in my docker container on my remote machine? I don`t get it.


thank you very much!

Comment actions Permalink

Yeah I have problem to map local with docker remote

Comment actions Permalink

Erison Silva, could you please tell more about your case?
Do you have a Docker Compose or a simple Docker configuration? What does not work exactly?

Comment actions Permalink

Hi Vasiliy Yur

I'm trying to use docker remote via ssh. the connection is working properly.

it's my docker config

but when I run my container like

version: '3.8'
image: nginx:1.17
- ./api:/app
- ./api/.docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- "8000:80"
- php

it's returning this error

Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting "/Users/erison.silva/Projects/myprofile/api/.docker/nginx/nginx.conf" to rootfs at "/var/lib/docker/overlay2/377268b48376ad5e82acbda1e2886f3b86781de298567396c35eeb1a9df46ec4/merged/etc/nginx/nginx.conf" caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

and I saw that it's creating the same path in my remote server like "Users/....."

and nothing is mapped to the correct folder

Comment actions Permalink

Hey Erison Silva,

Thanks for the explanation. I have played around with the SSH remote Docker installation and may confirm a similar behaviour. What happens here is that it tries to mount your "./api" volume in your Docker Compose file not from a remote SSH server but from the workstation where IDE is running. In case of Windows client + remote SSH Linux Docker machine, things are even worse:


Not sure if there is any workaround for now apart from having a copy of mounted volumes on your remote Docker server and specifying a full path in YML config file, like:


- /home/user/projects/test/api:/app
- /home/user/projects/test/:/etc/nginx/nginx.conf

Please sign in to leave a comment.