I have a situation where I want to directly edit files in the container from an IDE running on dockerhost (Linux desktop).
I have an image (Ruby Rails) which does not contain the editable directories. So I start a container and use the -v switch like this:
The problem is, that, when creating the container with ‘docker run’, a script in the container creates /var/www/codedir and initializes code and directories inside (‘rails new myapp’). But for some reason directories and code is never created and the container doesn’t start. On the dockerhost however, the drectories application/codedir are created (using mkdir).
When I remove the -v switch from the docker run command and enter the container, the script runs flawlessly when started mannually.
Has this anything to do with permissions? Host directories are created as root.
Is it not possible to create directories in the container which are ‘copied’ to the host using -v?
mkdir -p /var/www
rails new $RUBYAPP