Skip to content

/usr/local/bin/docker-entrypoint.sh can not splice command and parameters correctly #1456

Description

@stanxing

Environment

  • Platform: Macos & CentOS
  • Docker Version: 19.03
  • Node.js Version:
  • Image Tag: node:14-slim

Expected Behavior

docker run -it --rm \
    --name "test-slim" \
    --workdir /app \
    -v $(pwd)/:/app \
    node:14-slim \
    dist/index.js

docker run can run correctly.

-->

Current Behavior

The docker command has saome errors as below:

/usr/local/bin/docker-entrypoint.sh: 11: exec: dist/index.js: Permission denied

I debug found that [ -z "$(command -v "${1}")" ] return wrong bool value causing executable command could not patch node prefix. I executed this script in my local env without docker and it worked. My sh version is 3.2, maybe is sh version the root casue in image?

This is docker-entrypoint.sh, https://github.com/nodejs/docker-node/blob/main/docker-entrypoint.sh#L4

#!/bin/sh
set -e

if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
  set -- node "$@"
fi

exec "$@"

Possible Solution

Steps to Reproduce

Additional Information

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions