Docker on Linux - Empty mounted volumes

 ̄綄美尐妖づ 提交于 2019-12-11 06:03:27

问题


I'm trying to get my docker setup to work on my linux machine (it works fine on OSX). I can't for the life of me get the volumes to mount properly on the linux box.

I'm on Elementary OS 0.4 Loki (64-bit)

docker version

Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:14:09 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.04.0-ce
 API version:  1.28 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Wed Apr  5 18:45:47 2017
 OS/Arch:      linux/amd64
 Experimental: false

docker-machine version

docker-machine version 0.10.0, build 76ed2a6

I'm doing the following;

docker run -it -a stdout -a stderr -v /home/joel/Sites:/var/www/test --name=app pallantdigital/php7

However when I look in the container, at the /var/www folder, while it seems to pull in the folder structure ( or at least some of it ), and there are no files in the folders.

I've also tried using docker-compose like so;

image: pallantdigital/php7
  volumes:
    - /home/joel/Sites:/var/www/test

With the same result, the folder clearly gets 'mounted' but there are no files.

If I do docker inspect on the normal docker run container I get the following under 'Mounts'

"Mounts": [
        {
            "Type": "bind",
            "Source": "/home/joel/Sites",
            "Destination": "/var/www/test",
            "Mode": "",
            "RW": true,
            "Propagation": ""
        }
    ],

It's strange that 'mode' is empty.

The purpose of this was to build a development environment with a live/editable code base on the local machine which is synced across to the docker container (this is how I have it running on my mac). The php7 image is just Ubuntu with PHP7 installed.

Unfortunately most of the support questions around seem to be for Windows and Mac OSX. I've tried a few of the things people suggest, i.e. sending UID, Making sure that VirtualBox Shared Folder included the /home directory.

Any assistance would be grand, let me know if I can offer any extra information.

来源:https://stackoverflow.com/questions/43346605/docker-on-linux-empty-mounted-volumes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!