mirror of https://github.com/docker/docs.git
Merge pull request #1513 from dotcloud/add_user_dockerfile
Add USER instruction do Dockerfile
This commit is contained in:
commit
6da071985f
|
@ -197,6 +197,11 @@ func (b *buildFile) CmdExpose(args string) error {
|
||||||
return b.commit("", b.config.Cmd, fmt.Sprintf("EXPOSE %v", ports))
|
return b.commit("", b.config.Cmd, fmt.Sprintf("EXPOSE %v", ports))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *buildFile) CmdUser(args string) error {
|
||||||
|
b.config.User = args
|
||||||
|
return b.commit("", b.config.Cmd, fmt.Sprintf("USER %v", args))
|
||||||
|
}
|
||||||
|
|
||||||
func (b *buildFile) CmdInsert(args string) error {
|
func (b *buildFile) CmdInsert(args string) error {
|
||||||
return fmt.Errorf("INSERT has been deprecated. Please use ADD instead")
|
return fmt.Errorf("INSERT has been deprecated. Please use ADD instead")
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,6 +270,17 @@ func TestBuildMaintainer(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBuildUser(t *testing.T) {
|
||||||
|
img := buildImage(testContextTemplate{`
|
||||||
|
from {IMAGE}
|
||||||
|
user dockerio
|
||||||
|
`, nil, nil}, t, nil, true)
|
||||||
|
|
||||||
|
if img.Config.User != "dockerio" {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestBuildEnv(t *testing.T) {
|
func TestBuildEnv(t *testing.T) {
|
||||||
img := buildImage(testContextTemplate{`
|
img := buildImage(testContextTemplate{`
|
||||||
from {IMAGE}
|
from {IMAGE}
|
||||||
|
|
|
@ -205,14 +205,23 @@ to the entrypoint.
|
||||||
The ``VOLUME`` instruction will add one or more new volumes to any
|
The ``VOLUME`` instruction will add one or more new volumes to any
|
||||||
container created from the image.
|
container created from the image.
|
||||||
|
|
||||||
3.10 WORKDIR
|
3.10 USER
|
||||||
--------------
|
---------
|
||||||
|
|
||||||
|
``USER daemon``
|
||||||
|
|
||||||
|
The ``USER`` instruction sets the username or UID to use when running
|
||||||
|
the image.
|
||||||
|
|
||||||
|
3.11 WORKDIR
|
||||||
|
------------
|
||||||
|
|
||||||
``WORKDIR /path/to/workdir``
|
``WORKDIR /path/to/workdir``
|
||||||
|
|
||||||
The ``WORKDIR`` instruction sets the working directory in which
|
The ``WORKDIR`` instruction sets the working directory in which
|
||||||
the command given by ``CMD`` is executed.
|
the command given by ``CMD`` is executed.
|
||||||
|
|
||||||
|
|
||||||
4. Dockerfile Examples
|
4. Dockerfile Examples
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue