зеркало из https://github.com/microsoft/docker.git
Add support for volume consistency in compose format.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Родитель
30cdabd13f
Коммит
ae27355b09
|
@ -28,10 +28,11 @@ func convertVolumeToMount(
|
||||||
namespace Namespace,
|
namespace Namespace,
|
||||||
) (mount.Mount, error) {
|
) (mount.Mount, error) {
|
||||||
result := mount.Mount{
|
result := mount.Mount{
|
||||||
Type: mount.Type(volume.Type),
|
Type: mount.Type(volume.Type),
|
||||||
Source: volume.Source,
|
Source: volume.Source,
|
||||||
Target: volume.Target,
|
Target: volume.Target,
|
||||||
ReadOnly: volume.ReadOnly,
|
ReadOnly: volume.ReadOnly,
|
||||||
|
Consistency: mount.Consistency(volume.Consistency),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anonymous volumes
|
// Anonymous volumes
|
||||||
|
|
|
@ -220,6 +220,10 @@ services:
|
||||||
- ~/configs:/etc/configs/:ro
|
- ~/configs:/etc/configs/:ro
|
||||||
# Named volume
|
# Named volume
|
||||||
- datavolume:/var/lib/mysql
|
- datavolume:/var/lib/mysql
|
||||||
|
- type: bind
|
||||||
|
source: ./opt
|
||||||
|
target: /opt
|
||||||
|
consistency: cached
|
||||||
|
|
||||||
working_dir: /code
|
working_dir: /code
|
||||||
|
|
||||||
|
|
|
@ -910,6 +910,7 @@ func TestFullExample(t *testing.T) {
|
||||||
{Source: workingDir + "/static", Target: "/var/www/html", Type: "bind"},
|
{Source: workingDir + "/static", Target: "/var/www/html", Type: "bind"},
|
||||||
{Source: homeDir + "/configs", Target: "/etc/configs/", Type: "bind", ReadOnly: true},
|
{Source: homeDir + "/configs", Target: "/etc/configs/", Type: "bind", ReadOnly: true},
|
||||||
{Source: "datavolume", Target: "/var/lib/mysql", Type: "volume"},
|
{Source: "datavolume", Target: "/var/lib/mysql", Type: "volume"},
|
||||||
|
{Source: workingDir + "/opt", Target: "/opt", Consistency: "cached", Type: "bind"},
|
||||||
},
|
},
|
||||||
WorkingDir: "/code",
|
WorkingDir: "/code",
|
||||||
}
|
}
|
||||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -249,6 +249,7 @@
|
||||||
"source": {"type": "string"},
|
"source": {"type": "string"},
|
||||||
"target": {"type": "string"},
|
"target": {"type": "string"},
|
||||||
"read_only": {"type": "boolean"},
|
"read_only": {"type": "boolean"},
|
||||||
|
"consistency": {"type": "string"},
|
||||||
"bind": {
|
"bind": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
@ -229,12 +229,13 @@ type ServicePortConfig struct {
|
||||||
|
|
||||||
// ServiceVolumeConfig are references to a volume used by a service
|
// ServiceVolumeConfig are references to a volume used by a service
|
||||||
type ServiceVolumeConfig struct {
|
type ServiceVolumeConfig struct {
|
||||||
Type string
|
Type string
|
||||||
Source string
|
Source string
|
||||||
Target string
|
Target string
|
||||||
ReadOnly bool `mapstructure:"read_only"`
|
ReadOnly bool `mapstructure:"read_only"`
|
||||||
Bind *ServiceVolumeBind
|
Consistency string
|
||||||
Volume *ServiceVolumeVolume
|
Bind *ServiceVolumeBind
|
||||||
|
Volume *ServiceVolumeVolume
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServiceVolumeBind are options for a service volume of type bind
|
// ServiceVolumeBind are options for a service volume of type bind
|
||||||
|
|
Загрузка…
Ссылка в новой задаче