dotcloud/docker — pull request #1405 by jonasi (2013-08-05 00:38:59+00:00)
Title: Allow ENTRYPOINT without CMD

This pull request actually fixes a couple of related **ENTRYPOINT** issues:

The following Dockerfile

```
FROM ubuntu
ENTRYPOINT ["echo"]
```

will build fine, but will fail on a run (with no args) with `Error: No command specified`

My expectation is that `echo` will run with no args. If you pass in args, (`docker run test /var`) everything will work fine.

The following Dockerfile

```
FROM ubuntu
RUN echo "HELLO"
ENTRYPOINT ["echo"]
```

produces the same result but building and running this (with no args)

```
FROM ubuntu
RUN echo "HELLO"
ADD test /test
ENTRYPOINT ["echo"]
```
produces

```
vagrant@local-docker:~$ docker run test
/bin/sh -c echo "HELLO"
```
Running with args works as expected.

Seems like the execed cmd in `CmdRun` is unintentionally getting cached and passed as an argument to the `Entrypoint` cmd.

This pull request
- makes sure that `config.Cmd` is cleaned within `CmdRun`
- allows for no command to specified if there is an entrypoint