Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty mount points after docker-compose up #22430

Closed
cmaessen opened this issue Apr 30, 2016 · 12 comments
Closed

Empty mount points after docker-compose up #22430

cmaessen opened this issue Apr 30, 2016 · 12 comments

Comments

@cmaessen
Copy link

Output of docker version:

Client:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Tue Apr 26 23:44:17 2016
 OS/Arch:      windows/amd64

Server:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Wed Apr 27 00:34:20 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 4
 Running: 3
 Paused: 0
 Stopped: 1
Images: 4
Server Version: 1.11.1
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 106
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host bridge null
Kernel Version: 4.4.8-boot2docker
Operating System: Boot2Docker 1.11.1 (TCL 7.0); HEAD : 7954f54 - Wed Apr 27 16:36:45 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 995.9 MiB
Name: default
ID: O63S:R25X:ROPH:XA64:FPN6:I6IG:IAG3:JSJF:ZB6R:EAX6:5QRN:BRUF
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug mode (client): false
Debug mode (server): true
 File Descriptors: 25
 Goroutines: 64
 System Time: 2016-04-30T04:56:44.27369006Z
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
 provider=virtualbox

Additional environment details (AWS, VirtualBox, physical, etc.):

  • Microsoft Windows [Version 10.0.10586]
  • VirtualBox 5.0.16 r 10871
  • Compose file based on this tutorial (runs and works)

Steps to reproduce the issue:

  1. In Virtual Box under 'Settings' -> 'Shared Folders' added 'workspaces' folder that points to 'F:\Workspaces' (Auto-mount and Make Permanent enabled)
  2. Add to docker-compose.yml:
  volumes:
    - /workspaces/AptanaStudio3/RealScepticTsuno/build/:/var/www/html/wp-content/themes/realsceptictsuno/
  1. docker-compose up (runs without giving any errors about mounts/volumes)

Describe the results you received:

docker@default:/workspaces/AptanaStudio3/RealScepticTsuno/build$ ls -hla
total 0
drwxr-xr-x    2 root     root          40 Apr 30 04:33 ./
drwxr-xr-x    3 root     root          60 Apr 30 04:33 ../

The WordPress container does see the theme folder and is complaining about the missing theme style file (indicating that the mount is indeed available but doesn't have any content).

Describe the results you expected:

File listing as generated by my build process for a WordPress theme.

Additional information you deem important (e.g. issue happens only occasionally):

I strongly suspect that I'm doing something that isn't correct. But any documentation I've found, or tutorials, are extremely silent on the details of how these mounts work if you're not in c:/users on Windows. Even the official docker documentation[doesn't mention this in their WordPress quickstart nor does the docker-compose documentation clarify this.

@cmaessen cmaessen changed the title Empty mount points after docker-compose run Empty mount points after docker-compose up Apr 30, 2016
@fntlnz
Copy link
Member

fntlnz commented Apr 30, 2016

Files are available in the /var/www/html/wp-content/themes/realsceptictsuno/ folder?

Can you please post the output of this command? (substitute container-id with your)

 docker inspect -f '{{.HostConfig.Binds}}' <container-id>

@cmaessen
Copy link
Author

The default machine in VirtualBox (I started a SSH session to confirm this) nor the container see any files in /var/www/html/wp-content/themes/realsceptictsuno/.

On my machine the files are in the directory F:\Workspaces\AptanaStudio3\RealScepticTsuno\build. I've linked F:\Workspaces to \workspaces in VirtualBox which if I understand the instructions correctly means I can then write an absolute path starting with /workspaces to access the files that I have in F:\Workspaces.

Here's the result of the docker inspect command for the WordPress container:

[/workspaces/AptanaStudio3/RealScepticTsuno/build:/var/www/html/wp-content/themes/realsceptictsuno:rw]

For context, here's the docker-compose.yml content:

wordpress:
  image: wordpress
  links:
    - wordpress_db:mysql
  ports:
    - 8080:80
  volumes:
    - /workspaces/AptanaStudio3/RealScepticTsuno/build/:/var/www/html/wp-content/themes/realsceptictsuno/
wordpress_db:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: examplepass
phpmyadmin:
  image: corbinu/docker-phpmyadmin
  links:
    - wordpress_db:mysql
  ports:
    - 8181:80
  environment:
    MYSQL_USERNAME: root
    MYSQL_ROOT_PASSWORD: examplepass

@thaJeztah
Copy link
Member

If I understand correctly, this is the output you see when logged in to the VM;

docker@default:/workspaces/AptanaStudio3/RealScepticTsuno/build$ ls -hla
total 0
drwxr-xr-x    2 root     root          40 Apr 30 04:33 ./
drwxr-xr-x    3 root     root          60 Apr 30 04:33 ../

If that's indeed the case, then this sounds like either a VirtualBox, or configuration issue; for some reason, it looks like VirtualBox did not create / mount your /workspaces/ share. I'd start with debugging that, because if those files are not visible inside the VM, docker won't see them either, and create an empty directory (and mount that inside the container)

@cmaessen
Copy link
Author

Yes, you read that correctly.

I did a restart of the VirtualBox machine and the /workspaces folder is now gone. Despite it still showing up In VirtualBox under 'Settings' -> 'Shared Folders' (Auto-mount and Make Permanent enabled).

According to the VirtualBox documentation that should work. I'm getting the suspicion there's some weird interaction going on as the /c/Users mount shown right next to my /workspaces mount in the same dialogue is still there and works. That's the default mount that's used by docker for access to the local filesystem on Windows.

Are there docker configuration files that I need to change to let this work properly?

@thaJeztah
Copy link
Member

Hm, you may need to actually mount that from inside the VM. See https://github.com/boot2docker/boot2docker/#folder-sharing

Also, this may be of interest to you, if you haven't yet signed up for the beta; https://blog.docker.com/2016/03/docker-for-mac-windows-beta/

If you already signed up, but didn't get a code yet, feel free to send me an email with the Docker Hub Id you used to sign up (sebastiaan at docker)

@cmaessen
Copy link
Author

cmaessen commented Apr 30, 2016

That doesn't read like a stable feature at all... Though might still be wise to mention this info in the volume documentation for docker-compose. It would have saved me some frustration in figuring out what was going on and why it didn't work:

It is also important to note that in the future, the plan is to have any share which is created in VirtualBox with the "automount" flag turned on be mounted during boot at the directory of the share name (ie, a share named home/jsmith would be automounted at /home/jsmith).

So for anyone finding this thread, this is what I did to get it to work:

  1. In Virtual Box under 'Settings' -> 'Shared Folders' added 'workspaces' and pointed it to the location I want to mount. In my case this is 'F:\Workspaces' (Auto-mount and Make Permanent enabled)
  2. Start Docker Quickstart Terminal
  3. Type 'docker-machine ssh default' (the VirtualBox VM that Docker uses is called 'default')
  4. Go to the root of the VM filesystem, command 'cd /'
  5. Switch to the user root by typing 'sudo su'
  6. Create the directory you want to use as a mount point. Which in my case is the same as the name of the shared folder in VirtualBox: 'mkdir workspaces'
  7. Mount the VirtualBox shared folder by typing 'mount -t vboxsf -o uid=1000,gid=50 workspaces /workspaces' (the first 'workspaces' is the VirtualBox shared folder name, the second '/workspaces' is the directory I just created and want to use as the mount point).
  8. Now I can add a volume to my Docker file like this: '- /workspaces/AptanaStudio3/RealScepticTsuno/build/:/var/www/html/wp-content/themes/realsceptictsuno/' (left side is the /workspaces mount in my VM, the right side is the directory to mount in my docker container)
  9. Run the command 'docker-compose up' to start using the mount (to be clear: run this command via the Docker Quickstart Terminal outside of your SSH session on your local file system where your docker-compose.yml file is located).

I thought I could be clever by creating a symbolic link to my workspace. By using that I wouldn't need to worry or think about having non-standard mount points mounted in my VM. And a symbolic link does show up in the /c/Users mount but you can't do anything with it. Apparently the current set up cannot handle symbolic links.

thaJeztah, thanks for the offer to let me in the beta. But at the moment it's not an option for me:

Docker for Windows runs on 64bit Windows 10 Pro, Enterprise and Education

I have a Home edition of Windows 10. I do also have a Mac but this would complicate Docker usage for me as I'm setting up these environments for usage on both Macs and Windows machines. Though I'll keep an eye out for the announcement that the beta is now available for Windows Home editions (assuming this is announced on the blog).

@thaJeztah
Copy link
Member

Good to hear you got it working; I agree that these steps should be described somewhere in the documentation. Not sure if it's part of docker-compose, but probably a section in the docker toolbox (https://github.com/docker/toolbox/tree/master/docs) or docker machine documentation (https://github.com/docker/machine/tree/master/docs). It would be awesome if someone wants to contribute that, but feel free to open an issue in the docker machine issue tracker to raise this; https://github.com/docker/machine/issues

Though I'll keep an eye out for the announcement that the beta is now available for Windows Home editions

Unfortunately, I don't expect Docker for Windows to become available for Windows 10 Home Edition, as it requires Hyper-V, which is not available in Home Edition (see the comparison matrix), unless Microsoft decides to change this.

I'll go ahead and close this issue, because the original issue is resolved, and changes to the documentation should be made in the repositories mentioned, but feel free to continue the discussion. 👍

@cmaessen
Copy link
Author

cmaessen commented Apr 30, 2016

Completely forgot about that detail about Hyper-V support on Windows.

I've created the issue so that this at least can be tracked and maybe increase discoverability of this information for anyone else encountering this.

The only remark I have is that this information of course shouldn't be in the docker-compose documentation. Though a reference to it would be a good idea. That would prevent a lot of confusion and digging around for anyone who runs into on this issue when working with volumes on Windows.

@thaJeztah
Copy link
Member

Thanks!

@midhun1993
Copy link

That doesn't read like a stable feature at all... Though might still be wise to mention this info in the volume documentation for docker-compose. It would have saved me some frustration in figuring out what was going on and why it didn't work:

It is also important to note that in the future, the plan is to have any share which is created in VirtualBox with the "automount" flag turned on be mounted during boot at the directory of the share name (ie, a share named home/jsmith would be automounted at /home/jsmith).

So for anyone finding this thread, this is what I did to get it to work:

  1. In Virtual Box under 'Settings' -> 'Shared Folders' added 'workspaces' and pointed it to the location I want to mount. In my case this is 'F:\Workspaces' (Auto-mount and Make Permanent enabled)
  2. Start Docker Quickstart Terminal
  3. Type 'docker-machine ssh default' (the VirtualBox VM that Docker uses is called 'default')
  4. Go to the root of the VM filesystem, command 'cd /'
  5. Switch to the user root by typing 'sudo su'
  6. Create the directory you want to use as a mount point. Which in my case is the same as the name of the shared folder in VirtualBox: 'mkdir workspaces'
  7. Mount the VirtualBox shared folder by typing 'mount -t vboxsf -o uid=1000,gid=50 workspaces /workspaces' (the first 'workspaces' is the VirtualBox shared folder name, the second '/workspaces' is the directory I just created and want to use as the mount point).
  8. Now I can add a volume to my Docker file like this: '- /workspaces/AptanaStudio3/RealScepticTsuno/build/:/var/www/html/wp-content/themes/realsceptictsuno/' (left side is the /workspaces mount in my VM, the right side is the directory to mount in my docker container)
  9. Run the command 'docker-compose up' to start using the mount (to be clear: run this command via the Docker Quickstart Terminal outside of your SSH session on your local file system where your docker-compose.yml file is located).

I thought I could be clever by creating a symbolic link to my workspace. By using that I wouldn't need to worry or think about having non-standard mount points mounted in my VM. And a symbolic link does show up in the /c/Users mount but you can't do anything with it. Apparently the current set up cannot handle symbolic links.

thaJeztah, thanks for the offer to let me in the beta. But at the moment it's not an option for me:

Docker for Windows runs on 64bit Windows 10 Pro, Enterprise and Education

I have a Home edition of Windows 10. I do also have a Mac but this would complicate Docker usage for me as I'm setting up these environments for usage on both Macs and Windows machines. Though I'll keep an eye out for the announcement that the beta is now available for Windows Home editions (assuming this is announced on the blog).

Hi @cmaessen
I followed these steps, it's working awsome :)
But after i restarted the system it stopped working, i repeated these steps again and it worked.
can i mount it permenantly ?

@cmaessen
Copy link
Author

That doesn't read like a stable feature at all... Though might still be wise to mention this info in the volume documentation for docker-compose. It would have saved me some frustration in figuring out what was going on and why it didn't work:

It is also important to note that in the future, the plan is to have any share which is created in VirtualBox with the "automount" flag turned on be mounted during boot at the directory of the share name (ie, a share named home/jsmith would be automounted at /home/jsmith).

So for anyone finding this thread, this is what I did to get it to work:

  1. In Virtual Box under 'Settings' -> 'Shared Folders' added 'workspaces' and pointed it to the location I want to mount. In my case this is 'F:\Workspaces' (Auto-mount and Make Permanent enabled)
  2. Start Docker Quickstart Terminal
  3. Type 'docker-machine ssh default' (the VirtualBox VM that Docker uses is called 'default')
  4. Go to the root of the VM filesystem, command 'cd /'
  5. Switch to the user root by typing 'sudo su'
  6. Create the directory you want to use as a mount point. Which in my case is the same as the name of the shared folder in VirtualBox: 'mkdir workspaces'
  7. Mount the VirtualBox shared folder by typing 'mount -t vboxsf -o uid=1000,gid=50 workspaces /workspaces' (the first 'workspaces' is the VirtualBox shared folder name, the second '/workspaces' is the directory I just created and want to use as the mount point).
  8. Now I can add a volume to my Docker file like this: '- /workspaces/AptanaStudio3/RealScepticTsuno/build/:/var/www/html/wp-content/themes/realsceptictsuno/' (left side is the /workspaces mount in my VM, the right side is the directory to mount in my docker container)
  9. Run the command 'docker-compose up' to start using the mount (to be clear: run this command via the Docker Quickstart Terminal outside of your SSH session on your local file system where your docker-compose.yml file is located).

I thought I could be clever by creating a symbolic link to my workspace. By using that I wouldn't need to worry or think about having non-standard mount points mounted in my VM. And a symbolic link does show up in the /c/Users mount but you can't do anything with it. Apparently the current set up cannot handle symbolic links.
thaJeztah, thanks for the offer to let me in the beta. But at the moment it's not an option for me:

Docker for Windows runs on 64bit Windows 10 Pro, Enterprise and Education

I have a Home edition of Windows 10. I do also have a Mac but this would complicate Docker usage for me as I'm setting up these environments for usage on both Macs and Windows machines. Though I'll keep an eye out for the announcement that the beta is now available for Windows Home editions (assuming this is announced on the blog).

Hi @cmaessen
I followed these steps, it's working awsome :)
But after i restarted the system it stopped working, i repeated these steps again and it worked.
can i mount it permenantly ?

Those steps should be permanent. That's what the options Auto-mount and Make Permanent are for.

@midhun1993
Copy link

Ah.. i cross checked it, it was my docker-compose.yml configuration issue.
Thank you for the clarification :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants