Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use salesforce/cli docker slim image #2613

Closed
carlosabella opened this issue Dec 19, 2023 · 7 comments
Closed

Unable to use salesforce/cli docker slim image #2613

carlosabella opened this issue Dec 19, 2023 · 7 comments
Labels
more information required Issue requires more information or a response from the customer

Comments

@carlosabella
Copy link

carlosabella commented Dec 19, 2023

Note
Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI.
  • You've searched both open and closed issues for related posts.
  • You've used the doctor command to diagnose common issues.
  • You understand that GitHub Issues don't adhere to any agreement or SLA.
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

I am trying to use the slim docker image from docker hub (2.23.4-slim)

And when I execute simply: sf -v
I get this error: /usr/local/sf/bin/sf: line 45: 21 Segmentation fault "$NODE" "$DIR/run" "$@"

I can't use it in my daily work.

Steps To Reproduce

IMPORTANT
Provide a repository that's configured to reproduce the issue. If you are unable to provide a repo, please explain why not. The more info we have from the start, the faster we can resolve your issue.
We may close your issue if you don't include proper instructions.

  • Generate a project with sf project generate or fork dreamhouse-lwc.
  • Provide detailed step-by-step instructions on how to reproduce the issue.

Having docker engine installed in Mac OS Sonoma 14.2
docker pull salesforce/cli:2.23.4-slim
docker run --name salesforce -it salesforce/cli:2.23.4-slim

In the container terminal
root@0dcf76c916aa:/#
Write sf -v

Expected result

@salesforce/cli/2.21.8 darwin-x64 node-v20.10.0

Actual result

/usr/local/sf/bin/sf: line 45: 21 Segmentation fault "$NODE" "$DIR/run" "$@"

System Information

I am using Mac OS Sonoma 14.2. Terminal is zsh

This does not apply because I can't install the cli in the docker image

Additional information

@carlosabella carlosabella added the investigating We're actively investigating this issue label Dec 19, 2023
Copy link

Hello @carlosabella 👋 It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue.
    • A repository that clearly demonstrates the bug is ideal.
  • Make sure you've installed the latest version of Salesforce CLI. (docs)
    • Better yet, try the rc or nightly versions. (docs)
  • Try running the doctor command to diagnose common issues.
  • Search GitHub for existing related issues.

Thank you!

Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added more information required Issue requires more information or a response from the customer and removed investigating We're actively investigating this issue labels Dec 19, 2023
@iowillhoit
Copy link
Contributor

Interesting, we have not changed in that Dockerfile for a long time. Are you seeing this on any other Docker-slim versions? The "verify" step for 2.23.4 just passed yesterday https://github.com/salesforcecli/cli/actions/runs/7250635676/job/19751675906#step:3:25

@carlosabella
Copy link
Author

Thanks for answering @iowillhoit . I have just retry this (just in case):
docker pull salesforce/cli:2.23.4-slim
docker run -it salesforce/cli:2.23.4-slim
Once I am in the container terminal I execute:
sf version
And I get the error: /usr/local/sf/bin/sf: line 45: 21 Segmentation fault "$NODE" "$DIR/run" "$@"

Certainly I can see the "verify" step passes. And the command: java --version works perfectly.

Any further idea? Thanks for helping

@cristiand391
Copy link
Member

@carlosabella

I'm on macos sonomia 14.2 too and can't repro this:
Screenshot 2024-01-02 at 11 24 33

does the previous slim images work for you?

@carlosabella
Copy link
Author

@cristiand391 Thanks for the help.
Yes it happens with previous images also. Today I could dig a bit more and I found the following:
The error says:
image
So I checked the path: /usr/local/sf/bin/sf
And I opened the "sf" file. What I found is the following:

`#!/usr/bin/env bash
set -e
echoerr() { echo "$@" 1>&2; }

get_script_dir () {
SOURCE="${BASH_SOURCE[0]}"

While $SOURCE is a symlink, resolve it

while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$( readlink "$SOURCE" )"
# If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo "$DIR"
}
DIR=$(get_script_dir)
CLI_HOME=$(cd && pwd)
XDG_DATA_HOME=${XDG_DATA_HOME:="$CLI_HOME/.local/share"}
CLIENT_HOME=${SF_OCLIF_CLIENT_HOME:=$XDG_DATA_HOME/sf/client}
BIN_PATH="$CLIENT_HOME/bin/sf"
if [ -z "$SF_REDIRECTED" ] && [ -x "$BIN_PATH" ] && [[ ! "$DIR/sf" -ef "$BIN_PATH" ]]; then
if [ "$DEBUG" == "" ]; then
echoerr "$BIN_PATH" "$@"
fi
SF_BINPATH="$BIN_PATH" SF_REDIRECTED=1 "$BIN_PATH" "$@"
else
export SF_BINPATH=${SF_BINPATH:="$DIR/sf"}
if [ -x "$(command -v "$XDG_DATA_HOME/oclif/node/node-custom")" ]; then
NODE="$XDG_DATA_HOME/oclif/node/node-custom"
elif [ -x "$(command -v "$DIR/node")" ]; then
NODE="$DIR/node"
elif [ -x "$(command -v "$XDG_DATA_HOME/oclif/node/node-20.10.0")" ]; then
NODE="$XDG_DATA_HOME/oclif/node/node-20.10.0"
elif [ -x "$(command -v node)" ]; then
NODE=node
else
echoerr 'Error: node is not installed.' >&2
exit 1
fi
if [ "$DEBUG" == "
" ]; then
echoerr SF_BINPATH="$SF_BINPATH" "$NODE" "$DIR/run" "$@"
fi
"$NODE" "$DIR/run" "$@"
fi`

What the command is showing as output is precisely what is in the last line of the code. But I can't understand why the execution of the command is getting to that line.

Anyone can help here?

Thanks a lot.

@carlosabella
Copy link
Author

carlosabella commented Jan 8, 2024

Hi again @iowillhoit @cristiand391,
I found the problem.

The problem was not in the image or the sf cli, the problem was in docker engine in MAC. There is a bug in Docker engine for mac. There are some issues with the "Virtualization Framework". I had it enabled by default. I had to change the file sharing implementation for containers and uncheck the Virtualization Framework. After that, it worked perfectly.
image

Here is the issue in docker: docker/for-mac#6824
Here is an article in stackoverflow: https://stackoverflow.com/questions/76735062/segmentation-fault-in-node-js-application-running-in-docker

Thank you very much for the help and sorry for the inconvenience due to it wasn't an "sf cli" problem.

You can close the issue.

@cristiand391 cristiand391 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more information required Issue requires more information or a response from the customer
Projects
None yet
Development

No branches or pull requests

3 participants