Compose: docker-compose run --entrypoint doesn't overwrite image entrypoint

Created on 7 Mar 2018  路  4Comments  路  Source: docker/compose

According to the docker-compose run output:

--entrypoint CMD      Override the entrypoint of the image.

But, it doesn't overwrite, it gets appended, or fails because it reads the CMD as a SERVICENAME. To reproduce:

Dockerfile:

FROM busybox

ENTRYPOINT ["echo","hello"]

docker-compose.yml:

version: '3'
services:
  test:
    build:
      context: .

Result:

$ docker-compose run test --entrypoint echo bye
hello --entrypoint echo bye
$ docker-compose run --entrypoint test echo bye
ERROR: No such service: echo

I've tried on a few different images, all with the same result.

$ docker-compose -v
docker-compose version 1.18.0, build 8dd22a9
kinquestion

Most helpful comment

docker-compose run --entrypoint="echo bye" test

All 4 comments

docker-compose run --entrypoint="echo bye" test

Nice thanks 馃憤
Tried every combination apart from that one 馃槀

Shall I stick a PR in to change the docs from --entrypoint CMD to --entrypoint=""?

It seems the other options use that convention: -u, --user="",-p, --publish=[] ...

Thanks, but the docstring is correct as it is :+1: changing it would prevent argument parsing from working properly.

In your case, the reason you need the quoted notation is because your entrypoint value contains whitespace. This is consistent with every other UNIX command line software. The cause of your failed attempts is more accurately due to not respecting the proper order (docker-compose [top-level options] run [run options] [service] [run command] [run args]) which is a bit unforgiving.

Okie dokie makes sense 馃憤

Was this page helpful?
0 / 5 - 0 ratings