问题描述
我在OS X上运行Docker 1.11,我试图找出我的本地卷的写入位置。我通过运行 docker volume create -name mysql
创建了一个Docker卷。然后我运行 docker volume检查mysql
,并输出以下内容:
[
{
Name:mysql,
Driver:local,
Mountpoint:/ mnt / sda1 / var / lib / docker /卷/ mysql / _data,
标签:{}
}
]
问题是我的机器上并不存在 / mnt / sda1 / var / lib / docker / volumes / mysql / _data
我以为也许这个问题是,直到它被一个容器使用才实际创建,所以我通过运行 docker run -name mysql -v mysql:/ var / lib / mysql启动一个容器-e MYSQL_ROOT_PASSWORD = mysql -P -d mysql:5.7
然后在MySQL中创建一个数据库,但挂载点仍然不存在。我甚至运行 docker检查mysql
以确保它使用正确的卷,并得到以下内容:
code> ...
Mounts:[
{
Name:mysql,
Source:/ mnt / sda1 / var / lib / docker / volumes / mysql / _data,
Destination:/ var / lib / mysql,
Driver:local,
Mode ,
RW:true,
传播:rprivate
}
],
...
在这一点上,我完全失去了写入数据的位置。因为Docker是基于Linux的,它不能直接在Windows / OS X上运行。相反,它是在运行Linux操作系统的VirtualBox虚拟机(Docker Machine)中运行。这就是为什么当您安装Docker Toolbox时,您会看到VirtualBox已安装。
要查看此虚拟机中的文件和文件夹,请使用
docker-machine ssh default
default
是默认的Docker Machine的名称。
I'm running Docker 1.11 on OS X and I'm trying to figure out where my local volumes are being written. I created a Docker volume by running docker volume create --name mysql
. I then ran docker volume inspect mysql
and it output the following:
[
{
"Name": "mysql",
"Driver": "local",
"Mountpoint": "/mnt/sda1/var/lib/docker/volumes/mysql/_data",
"Labels": {}
}
]
The issue is /mnt/sda1/var/lib/docker/volumes/mysql/_data
doesn't actually exist on my machine. I thought maybe the issue was that it didn't actually get created until it was used by a container so I started a container by running docker run --name mysql -v mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=mysql -P -d mysql:5.7
and then created a database in MySQL, but the mount point still doesn't exist. I even ran docker inspect mysql
to ensure it's using the correct volume and got the following:
...
"Mounts": [
{
"Name": "mysql",
"Source": "/mnt/sda1/var/lib/docker/volumes/mysql/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "z",
"RW": true,
"Propagation": "rprivate"
}
],
...
At this point I'm completely lost as to where the data is being written. What am I missing?
Because Docker is based on Linux, it cannot run directly on Windows/OS X. Instead, it runs inside a VirtualBox virtual machine (a Docker Machine) that runs a Linux operating system. That's why when you install Docker Toolbox you see that VirtualBox is installed.
To see files and folders inside this virtual machine, use
docker-machine ssh default
default
is the name of the default Docker Machine.
这篇关于Docker卷安装不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!