Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
| ... | ... |
@@ -255,11 +255,9 @@ func cmd(b *Builder, args []string, attributes map[string]bool) error {
|
| 255 | 255 |
func entrypoint(b *Builder, args []string, attributes map[string]bool) error {
|
| 256 | 256 |
b.Config.Entrypoint = handleJsonArgs(args, attributes) |
| 257 | 257 |
|
| 258 |
- if len(b.Config.Entrypoint) == 0 {
|
|
| 258 |
+ if len(b.Config.Entrypoint) == 0 && len(b.Config.Cmd) == 0 {
|
|
| 259 | 259 |
b.Config.Entrypoint = []string{"/bin/sh", "-c"}
|
| 260 |
- } |
|
| 261 |
- |
|
| 262 |
- if !b.cmdSet {
|
|
| 260 |
+ } else if !b.cmdSet {
|
|
| 263 | 261 |
b.Config.Cmd = nil |
| 264 | 262 |
} |
| 265 | 263 |
|
| ... | ... |
@@ -791,6 +791,25 @@ func TestBuildEntrypoint(t *testing.T) {
|
| 791 | 791 |
if res != expected {
|
| 792 | 792 |
t.Fatalf("Entrypoint %s, expected %s", res, expected)
|
| 793 | 793 |
} |
| 794 |
+ |
|
| 795 |
+ deleteImages(name) |
|
| 796 |
+ expected = "[]" |
|
| 797 |
+ |
|
| 798 |
+ _, err = buildImage(name, |
|
| 799 |
+ `FROM busybox |
|
| 800 |
+ ENTRYPOINT []`, |
|
| 801 |
+ true) |
|
| 802 |
+ if err != nil {
|
|
| 803 |
+ t.Fatal(err) |
|
| 804 |
+ } |
|
| 805 |
+ res, err = inspectField(name, "Config.Entrypoint") |
|
| 806 |
+ if err != nil {
|
|
| 807 |
+ t.Fatal(err) |
|
| 808 |
+ } |
|
| 809 |
+ if res != expected {
|
|
| 810 |
+ t.Fatalf("Entrypoint %s, expected %s", res, expected)
|
|
| 811 |
+ } |
|
| 812 |
+ |
|
| 794 | 813 |
logDone("build - entrypoint")
|
| 795 | 814 |
} |
| 796 | 815 |
|