Chris Stryczynski
Chris Stryczynski

Reputation: 33871

docker-compose is not passing CMD to entrypoint

version: '3.1'
services:
  abcxyz:
    command: php artisan queue:work

The related 'Dockerfile' has the following set:

ENTRYPOINT /tmp/entrypoint.sh

However if this docker-compose gets runs, and I inspect the container I see the following:

    "Entrypoint": [
        "/bin/sh",
        "-c",
        "/tmp/entrypoint.sh"
    ],

Why is it ignoring the command? The entrypoint script does not receive any parameters.


Setting the following within docker-compose.yaml:

entrypoint: /tmp/entrypoint.sh
command: "php artisan queue:work"

Results in an container with the following:

        "Cmd": null,
        "ArgsEscaped": true,
        "Image": "sha256:ba309b04dade86b5a2e849ec2eebab01f59949318f6baa173e318a76985c5ef1",
        "Volumes": null,
        "WorkingDir": "/var/www",
        "Entrypoint": [
            "/bin/sh",
            "-c",
            "/tmp/entrypoint.sh"
        ],

However the actual script gets passed a single first parameter of php instead of php artisan queue:work. !??!

Upvotes: 0

Views: 148

Answers (1)

Chris Stryczynski
Chris Stryczynski

Reputation: 33871

  abcxyz:
    entrypoint: "/tmp/entrypoint.sh \"php artisan queue:work\""

The above fixes it.

Upvotes: 1

Related Questions