Merge pull request #921 from tonistiigi/tmpfs-readwrite
dockerfile: make tmpfs mount readwrite by defaultdocker-19.03
commit
29d65d206e
|
@ -16,6 +16,7 @@ import (
|
|||
|
||||
var mountTests = []integration.Test{
|
||||
testMountContext,
|
||||
testMountTmpfs,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -49,3 +50,31 @@ RUN --mount=target=/context [ "$(cat /context/testfile)" == "contents0" ]
|
|||
}, nil)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func testMountTmpfs(t *testing.T, sb integration.Sandbox) {
|
||||
f := getFrontend(t, sb)
|
||||
|
||||
dockerfile := []byte(`
|
||||
FROM busybox
|
||||
RUN --mount=target=/mytmp,type=tmpfs touch /mytmp/foo
|
||||
RUN [ ! -f /mytmp/foo ]
|
||||
`)
|
||||
|
||||
dir, err := tmpdir(
|
||||
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
||||
)
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
c, err := client.New(context.TODO(), sb.Address())
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||
LocalDirs: map[string]string{
|
||||
builder.DefaultLocalNameDockerfile: dir,
|
||||
builder.DefaultLocalNameContext: dir,
|
||||
},
|
||||
}, nil)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ func parseMount(value string) (*Mount, error) {
|
|||
}
|
||||
|
||||
if roAuto {
|
||||
if m.Type == MountTypeCache {
|
||||
if m.Type == MountTypeCache || m.Type == MountTypeTmpfs {
|
||||
m.ReadOnly = false
|
||||
} else {
|
||||
m.ReadOnly = true
|
||||
|
|
Loading…
Reference in New Issue